View Full Version : In C++ How can I tell the difference between integers and characters?

11-18-2010, 05:41 PM
I am currently learning C++ and I have been asked to make a program which will calculate the interest that would be paid on a deposit of a given size. One of the requirements is that we display an error message when non-integer data is entered.

I however cannot work out how to detect if non-integer data has been entered. If anyone could provide an example of how this problem is solved it would be much appreciated!

11-18-2010, 06:05 PM
We are not supposed to do your homework. However, because you made it clear that it is homework, I will throw you a bone. You need to check the data range...

Giving you an example would essentially be giving you the answer. So, if you would like more help, you will have to post what you have so far...