C++ Program: [Switch] character is an alphabet or not by Using the switch statement
Write a C program to check whether a character is an alphabet or not by Using the switch statement.
Flowchart of C program to check whether a character is an alphabet or not
C program to check whether a character is an alphabet or not
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#include <iostream> using namespace std; int main() { char c; cout << "Enter a character?"<<endl; cin >> c; switch((c >= 'a'&& c <= 'z') || (c >= 'A' && c <= 'Z')) { case 0: cout << c << " is not an Alphabet."<<endl; break; case 1: cout << c << " is an Alphabet."<<endl; break; default: cout<<"Invalid input "<<endl; } } |
Output
Enter a character?
r
r is not an Alphabet.
SFT (Shamil’s Flow Table )
Are you interested to Read about SFT(Shamil’s Flow Table)?