
April 15th, 2005, 01:13 PM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 2
Time spent in forums: 40 m 19 sec
Reputation Power: 0
|
|
|
Using strings with vectors
Hello everyone! I'm fairly new to C++ and I've been having some problems using strings with vectors. Now from what I know, you create strings in C++ by using "char" like this:
So this is a string of 29 characters (with 1 extra for the null terminator).
Now I'm accepting some user input like this:
I've created a vector,
Code:
vector<char> planes;
and I'm trying to use the push back function like this:
Code:
planes.push_back(var1);
I get an error though that I can't do this. Does anyone know how I can accept strings as input and store them in a vector? If you need more info, let me know. Thanks and I really appreciate it.
|