0
Switch case
How to create a program that will accept character from A to E and identify if the character is -small letter or capital letter -is it is the 1st letter, 2nd letter, 3rd letter, 4th letter, 5th letter of the aphabet
4 Answers
0
https://code.sololearn.com/chJ1eAorSPzO/?ref=app
Hi, you can check my code. I've done a little
+ 6
Take a character as input.
cin >> ch
Then put it in switch
switch(ch)
Match the cases
case A:
cout << "capital" << "1st Letter" ;
break;
+ 1
Here is a one-liner that does it all, presuming the input is correct:
cout << ch << ((ch&32) ? " is lowercase" : " is uppercase") << " and is letter number " << ((ch|32) - 'a' + 1) << "." << endl;
- 1