Originally Posted by
Sebastiani
Well, then just call istream::get() until you hit a newline (or EOF).
I wont be able to use that either unfortunately...here is a sample of code I am working on basically I need to do something once and then terminate when I read in a \n or return. the code in question is the second while loop. ls their anyway to read in all of the characters into the char variable and then stop when I reach a \n so their wont be any that could be claimed by the float variable later on? Do you know what I mean? I am certain It must be something like this and I know I cant use any functions.
Code:
while( dependants != 'Y' && dependants != 'y' && dependants != 'n' && dependants != 'N' ){
cout << "You must answer with a 'y' or an 'n'.\n";
cout << "Do you have any dependants (y/n) -> ";
cin >> dependants;
while( dependants != '\n' ){
cin >> dependants;
}
}