Answer to Question #181476 in C++ for naura

Question #181476

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”.


1
Expert's answer
2021-04-14T14:05:58-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS