Hi,

I'm building an application to teach myself C++. I'm currently in the "fix areas where users could screw up the program" phase.

What I've noticed is that with something like:

int x = 0;
cout << "Enter an integer: "; cin >> x;

It's easy enough to have to fix the input stream if the user enters something like 'w' or another non-integer.

What I can't figure out, though, is how I can get around what occurs if the user mistakenly presses enter while not having entered any data. Usually the cursor just moves down the screen until something other than enter is input.

So the question is: if the user hits enter in a scenario like the above, but nothing else, how can I have another prompt that says something like: "Invalid entry. Try again: " type thing?

Thx