write the c++ programme to check whether the input character is a letter or a number
Answers
Answer:
Here you will lea rn and get co de on chec king whether the given character by user at run-time is an alphabet or not in C++. The program is created in follow ing two ways:
Che ck alphabet or not using character itself
Che ck alphabet or not using its ASCII value
Che ck Alphabet or Not in C++
To check whether the enter ed character is an alphabet or not in C++ progra mming, you have to ask from user to enter a cha racter and start ch ecking for alphabet.
This pro gram uses if-else state ment to check whe ther the value of cha racter is greater than or equal to a and less than or eq ual to z or not. If this cond ition eval uates to be true, then prints it as alp habet.
Other wise checks for upper case. That is, checks whether the value of character is greater than or equal to A (upper case) and less than or equal to Z (uppercase) or not. If eva luates to be true, then print it as an alphabet. Otherwise, if both the condition eva luates to be false, then print it as not an alpha bet.
Follo wing C++ prog ram asks from user to enter a char acter to check whether it is an alp habet: