Prompt user to enter only one character. The characters are as follows: {‘A’ , ‘a’ ,’B’, ‘b’}.Then display whether it is uppercase or lowercase letter by using switch.. case statement. If the user enters incorrect character, display the sentence “incorrect input”.
#include <iostream>
using namespace std;
int main()
{
char c;
cout<<"Enter one character: ";
cin >> c;
switch (c){
case 'a':
case 'b':cout << "lowercase letter"; break;
case 'A':
case 'B':cout << "Uppercase letter"; break;
default: cout << "incorrect input"; break;
}
return 0;
}
Comments
Leave a comment