really need help

I just started to study the C++ Programming Language. I'm done with the condition statements and jump statements. An idea came to my mind to create a simple program
that will determine if the input is a character or integer.
For example, the program asks you "How old are you?" and then you input a character (A-Z), the program will output "Your input is a Character."
Same as, if the program asks you "Choose a letter from A-Z" and then you input a integer (0-9), the program will output "Your input is a Integer."

Your reply will be a really big help to me as I study C++.

Thanks..
I remember doing this myself :D


Every character has a value from 0 to 255. You will need to find out which values are numbers and which ones are letters. (They are grouped)

Good luck :)
Do you want to check which inputs are letters and which aren't?

There's a header file for that.

http://www.cplusplus.com/reference/clibrary/cctype/

Yeah, I'm referencing an apple advert...
I'm ashamed.

(Thank you hanst for pointing out my mistake.)
Last edited on
Actually, everything you get as input are characters, you just want to distinguish between letters and digits. Just check if the value of the char is between (inclusive) '0' and '9' - then it's a digit. If it's between 'a' and 'z' OR between 'A' and 'Z' then it's a letter.
You can compare ASCI table's values.
Topic archived. No new replies allowed.