Answer to Question #173781 in C++ for P. Gokul

Question #173781

Brain teaser is a game that identifies basic knowledge of children’s for the age group 5 to 8 years. Identify whether the entered character is letter, digit or other symbols.

Test cases

Input

Output

Test case 1

Z

Alphabet

Test case 2

8

Number

Test case 3

$

Special Character


1
Expert's answer
2021-03-20T13:11:50-0400
#include <iostream>
using namespace std;

int main() {
    char character;

    cout << "Welcome to Brain teaser!\n"
            "It is a game that identifies basic knowledge of children’s for the age group 5 to 8 years.\n" 
            "Identify whether the entered character is letter, digit or other symbols.\n" << endl;

    cout << "Please enter your character: ";
    cin >> character;

    if ( (character > 64 && character < 91) || (character > 96 && character < 123) ) {
        cout << "Alphabet" << endl;
    } else if ( character > 47 && character < 58 ) {
        cout << "Number" << endl;
    } else {
        cout << "Special Character" << endl;
    }

    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