C++ Programming : Program 37-A
Program to identify if an input is a symbol, digit or character
#include <iostream.h> #include <conio.h> void main() { clrscr(); char charac; cout << "Enter your input : " << endl; cin>>charac; if(((charac>='A')&&(charac<='Z'))||((charac>='a')&&(charac<='z'))) cout << "Your input " << charac << " is a character." << endl; else if((charac>='0')&&(charac<='9')) cout << "Your input " << charac << " is a digit." << endl; else cout << "Your input " << charac << " is a symbol." << endl; getch(); }
This program takes in a character, a digit or a symbol charac as a screen input from the user.
#
Your input # is a symbol.
|
45 more pages in C++ Programming