output running nonstop

When my program prompt the user to enter numbers it will perform the calculation.

but when user enter it with characters (e.g a or b) the output will run nonstop....is there any way to stop this from happening?
im using the cin to get the input....how im gonna do that?
Did you read the article at all? It gives you the code to validate your input. That's exactly want you need..
I would also suggest that you can read your input as string, check if it's number and then convert it to one, but I think that the proposed article is better solution (and more c++-styled)
Topic archived. No new replies allowed.