Mail Archives: djgpp/1997/02/27/00:08:17
donjr AT erols DOT com (No One Important) wrote:
>I am having trouble using cin.get() outside of the main function.
>I prompt the user for input eg.
>char FullName[256];
>cout << "Enter Your Full Name\n:";
>cin.get(FullName,256);
>and the program compiles without error, but when I run it it skips
>right by the cin.get() and displays
>Enter Your Full Name
>:
>(The rest of the program)
>I have been able to use it in main, however, with the way my program
>works, it is impossible to put it in main without throwing the whole
>thing off.
>Please e-mail any advice to
>donjr AT erols DOT com
>Thank you,
>David Loose
Well, if I am not mistaken cin.get() just grabs a character from the
buffer and eats it. I think, by looking at your code, you mean to use
the function cin.getline().
- Raw text -