Two virtually useless replies it seems. Dancing around the problem isn't very helpful. Let's cover the first reply:
>system("PAUSE"); // in i believe.
Bad suggestion. I've explained why before.
>getchar(); // in
And this is different from cin.get()...how? The only difference is that now you don't attempt to handle extraneous characters in the stream.
Next reply:
>You should try my compiler.... I use microsoft
Allow me to translate: "Your compiler has a trivial issue with a trivial fix, but switch compilers anyway because I like the one I'm using better than the one you're using." Do us all a favor and don't post again unless you have something of value to add.
nico: Post the code that exhibits the problem. We work much better with compilable examples than with descriptions of a problem. But before you do, does this not work?
#include <ios> // For streamsize
#include <iostream>
#include <limits> // For numeric_limits
using namespace std;
int main()
{
// Put garbage on the stream
cout<<"Enter several characters: ";
cout<< cin.get() <<endl;
// Fix the problem
cin.ignore(numeric_limits<streamsize>::max(), '\n');
cout<<"Press [Enter] to continue"<<flush;
cin.get();
}
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401