How would you add a vector to the end of the collection of vectors of a class?
like..
trees is a class
vector <trees> a;
vector <trees> b;
Type: Posts; User: pandadc
How would you add a vector to the end of the collection of vectors of a class?
like..
trees is a class
vector <trees> a;
vector <trees> b;
If you had something like this:
int age;
string firstname;
cout << "Please enter in your age and first name:";
cin >> age >> firstname;
In main()
say you have something like this:
int main(){
int a;
I know that :
int atoi ( const char * string );
atoi() converts a string to an integer in C programming.
Is there an equivalent in C++ programming?
i just figured it out! thanks!
My code reads something like
ifstream fin;
cout << "enter filename:";
cin >> filename;
a = OpentheFile(filename, fin);
Say you have a file formatted like this (name, phone number):
Joe Smith, 9019809923
Greg Jones, 9019867823
and you use getline to read in the each line then push it into a vector of strings.
...
awesome twomers, thanks for the help! I figured it out.
This is what I have so far:
cout << "Please enter some text." << endl;
getline(cin, usertext, '.');
int end = 0;
int start = 0;
Hello All,
Is there anyway to break up getline by 'spaces' and insert each word into a vector?
I have the user stop at '.'. My code is as follows - it just inserts the whole string into a vector. ...