M
Mike
I seem to be having a problem with the following piece of (simple) code:
"""
#include <iostream>
using namespace std;
int main()
{
char ch;
ch = cin.get();
cout << "Got character...'" << ch << endl;
}
"""
This is using Visual C++ 6.0 (yes, I know. I'm a unix guy and don't like
it very much). As soon as a character is read, I want to immediately
display it. But, it wants to read until the newline before echoing the
character. What am I doing wrong? Probably something stupid...
The documentation says that it will read a single character, but it's
reading an entire line!
Thanks.
"""
#include <iostream>
using namespace std;
int main()
{
char ch;
ch = cin.get();
cout << "Got character...'" << ch << endl;
}
"""
This is using Visual C++ 6.0 (yes, I know. I'm a unix guy and don't like
it very much). As soon as a character is read, I want to immediately
display it. But, it wants to read until the newline before echoing the
character. What am I doing wrong? Probably something stupid...
The documentation says that it will read a single character, but it's
reading an entire line!
Thanks.