Determining if input is int, double, or char
Alright, I'm writing a program that calculates a grade average. I want to allow users to input integers (80, for instance), doubles (92.5), or letters (A, F, a, f, etc).
Basically, I'll be adding whatever the user enters to a total (letter grades will be given a predefined value... A will be 100, for instance, unless I can also allow for A+ type grades, but I'm not worried about that), and then dividing it by the total number of grades entered.
Main will prompt the user to input a grade, using the following as examples (85, 92.3, D), and then store their answer in the appropriate variable. What I don't know is how to determine if what they entered is an integer, a double, or a letter (I don't want to make a long if statement like "if (input == a) || (input == A) || (input == b) ||" and so on. I think I have a good way to determine if the input is a whole number or double (using modulus), so really I just want to know if there's a simple way to determine if input is a letter or number and then determine which variable to store it in.
I figure I'll have to use an overloaded extraction operator, but that still doesn't help me with the letter issue.
If I -have- to go with the long if (grade == A)... statement, then I will, but I want to know if there's a simpler way.
This is homework and not for practical use.
Thanks for any and all help.