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
#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;
}
Comments
Leave a comment