Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-18-2010, 04:41 PM   PM User | #1
madinjeck
New to the CF scene

 
Join Date: Nov 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
madinjeck is an unknown quantity at this point
In C++ How can I tell the difference between integers and characters?

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!
madinjeck is offline   Reply With Quote
Old 11-18-2010, 05:05 PM   PM User | #2
bobleny
Regular Coder

 
bobleny's Avatar
 
Join Date: May 2007
Posts: 256
Thanks: 3
Thanked 11 Times in 11 Posts
bobleny is on a distinguished road
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...
__________________
--www.firemelt.net--
* No good deed goes unpunished.
* Cheer up, the worst has yet to come...
Get Firefox!
bobleny is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:09 AM.


Advertisement
Log in to turn off these ads.