IL96
07-17-2001, 08:48 PM
HI, guys, once again I have a problem for which i'm seeking a solution.
I'm writing a program, a part of which prompts a user to enter "title" and "Author" as strings.
I'm using getline(cin, str_Var, '\n') like this:
cout<<"Enter Title: ";
getline(cin, str_Var, '\n');
str_Title=str_Var;
cout<<"Enter Author: ";
getline(cin, str_Var, '\n');
str_Author=str_Var;
When the program runs I have to press "ENTER" twice to pass the first getline operator, and it doesn't save the str_var to str_title, but put's it into str_author after secong getline...
I tried using cin.ignore();
but that doesn't help.
I also installed SP5 for vis studio 6...
HELP PLEASE this thing is killing me !
------------------
There are no stupid questions, there are stupid answers.
I'm writing a program, a part of which prompts a user to enter "title" and "Author" as strings.
I'm using getline(cin, str_Var, '\n') like this:
cout<<"Enter Title: ";
getline(cin, str_Var, '\n');
str_Title=str_Var;
cout<<"Enter Author: ";
getline(cin, str_Var, '\n');
str_Author=str_Var;
When the program runs I have to press "ENTER" twice to pass the first getline operator, and it doesn't save the str_var to str_title, but put's it into str_author after secong getline...
I tried using cin.ignore();
but that doesn't help.
I also installed SP5 for vis studio 6...
HELP PLEASE this thing is killing me !
------------------
There are no stupid questions, there are stupid answers.