473,320 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Help with vectors

I need to declare something like this: apvector<int> roster(10);
I need to change it so that the user can enter the length, so would this work( my compiler can't run vectors so I have no way of checking this)
Expand|Select|Wrap|Line Numbers
  1. cout<<"Enter the size of the vector: ";
  2. cin>>size;
  3. apvector<int> roster(size);
Please help.
Thanks in Advance.
Apr 23 '08 #1
4 1114
Laharl
849 Expert 512MB
How can your compiler not utilize vectors? The <vector> header is standardized across compilers. If you're working with a nonstandard class, as apvector would imply, just #include <vector> and replace apvector with vector. That said, assuming the input data is numeric, that should work, or at least it would for a standard vector.
Apr 23 '08 #2
How can your compiler not utilize vectors? The <vector> header is standardized across compilers. If you're working with a nonstandard class, as apvector would imply, just #include <vector> and replace apvector with vector. That said, assuming the input data is numeric, that should work, or at least it would for a standard vector.
THANKS ALOT, I really didn't know that, now I can finally test my vector programs.
One more thing can my compiler(Codewarrior) do fstream,string,and matrix. Are these standard
Apr 23 '08 #3
Laharl
849 Expert 512MB
CodeWarrior, as old as it is, should be able to handle the STL. A matrix class is nonstandard, though fstreams and strings are. For more information, look at this site, which contains documentation on the STL.
Apr 23 '08 #4
CodeWarrior, as old as it is, should be able to handle the STL. A matrix class is nonstandard, though fstreams and strings are. For more information, look at this site, which contains documentation on the STL.
You just made life a whole lot easier man. Now ALL my programs work when I change apstring to string and apvector to vector.
YOU ARE THE GREATEST PERSON EVER!!!!
Apr 23 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Pratyush | last post by:
Hi, Suppose there is a vector of objects of class A, i.e., std::vector<A> vec_A(N); The class A satisifies all the STL vector requirements. Now I wish to add some attributes for each of the...
5
by: Computer Whizz | last post by:
I was reading through Accelerated C++ at work when I read through the first mention of Vectors, giving us certain functions etc. Is there any benefit of Arrays over Vectors? Since all Vectors...
3
by: Amit | last post by:
Hello. I am having some problem organizing a set of vectors. The vectors itself, could contain a pointer( say integer pointer) or could contain another object MyClass. 1>So, first of all, is...
4
by: Dr. J.K. Becker | last post by:
Hi all, I have vectors that holds pointers to other vectors, like so: vector<whatever> x; vector<whatever*> z; z=&x; Now I add something to x
13
by: Ben | last post by:
I have a program which is using a lot of memory. At the moment I store a lot of pointers to objects in std::vector. (millions of them) I have three questions: 1) Lets say the average Vector...
4
by: Brian Basquille | last post by:
Hello all, Well, we've gotten to it: the real meaty area of my Air Hockey game.. Any help or suggestions for the following would be much appreciated. In plain terms: My paddle needs to be...
11
by: natman | last post by:
Hi i need to write a funcition called install, its takes as arguments 1- a vector 2-a number 3-a list called next_level so heres where it get kinda weird: next_level is a list comprising of...
5
by: madhu | last post by:
http://msdn2.microsoft.com/en-us/library/fs5a18ce(VS.80).aspx vector <intv1; v1.push_back( 10 ); //adds 10 to the tail v1.push_back( 20 ); //adds 20 to the tail cout << "The size of v1 is " <<...
2
by: Thelma Lubkin | last post by:
I use my own matrix and vector classes. I wrote them before such things were generally available and I've stuck with them ever since. I've just added an Octonion class derived from the vectors...
1
by: Rob | last post by:
How would I do this? I want to be able to handle vectors of many different types of data and vectors that can contain any number of other vectors of data. Currently, I have a templated...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.