Hi
I'm trying to write a simple programme to find if the entered character is a lowercase, uppercase, or a real number. Please don't forget I'm a beginner and know very little. So, please explain in as much detail as possible. I have a rough draft. I know there are two or more ways to do this but someone wants me to do this 'terrible' way. So, please help me. I can understand the look of the code might frustrate you. It did me. I'm sorry for that.
Code:#include <iostream> #include <conio.h> int main() { char r; cout << "Enter the letter" << endl; cin >> r; if ( (r=='A')||(r=='B')||(r=='C')||(r='D')||(r=='E')||(r=='F')||(r=='G')||(r=='H')|| (r=='I')||(r=='J')||(r=='K')||(r=='L')||(r=='M')||(r=='N')||(r=='O')||(r=='P')||(r=='Q')|| (r=='R')||(r=='S')||(r=='T')||(r=='U')||(r=='V')||(r=='W')||(r=='X')||(r=='Y')||(r=='Z') ) cout << "r is uppercase" << endl; else if ( (r=='a')||(r=='b')||(r=='c')||(r='d')||(r=='e')||(r=='f')||(r=='g')||(r=='h')||(r=='i')|| (r=='j')||(r=='k')||(r=='l')||(r=='m')||(r=='n')||(r=='o')||(r=='p')||(r=='q')||(r=='r')|| (r=='s')||(r=='t')||(r=='u')||(r=='v')||(r=='w')||(r=='x')||(r=='y')||(r=='z') ) cout << "r is lowercase" << endl; else if (r is a real number) else ??? getch(); }



LinkBack URL
About LinkBacks




