I'm having trouble getting strings from the user,
eg.
cin >> info;
User types: Misc info 1 2 3
cout << info;
output = Misc
how do i store the whole sentence with spaces???
"TIA"
[Borland Turbo C++ 3.0]
I'm having trouble getting strings from the user,
eg.
cin >> info;
User types: Misc info 1 2 3
cout << info;
output = Misc
how do i store the whole sentence with spaces???
"TIA"
[Borland Turbo C++ 3.0]
#define MAX_BUFFER 100
char info[MAX_BUFFER];
cin.getline(info, MAX_BUFFER);
the >> and << operators ignore spaces and newlines.
you'll have to do what the above posts says but i'll do it in the following way.
cin.getline(info,100,'\n);
this will exit if either 100 chars are inputed or enter is pressed, whichever is first.
PS you should have posted this in the C or C++ forum.
-