Write a C++ program that makes use of a switch statement but without the use of
ANY if statements. The program reads in a character (not including a white space)
from the user and then display accordingly:
"The input is a digit", if the character is between ‘0’ and ‘9’
"The input is an upper case letter” if the character is between ‘A’ and ‘Z”
"The input is a lower case letter" if the character is between ‘a’ and ‘z’
"The input is a special symbol” if otherwise
1
Expert's answer
2012-09-27T11:51:47-0400
#include <iostream> using namespace std;
int main() {
cout <<"Enter:& \n"; char q; cin>>q; if(q<='9' && q>='0'){ cout <<"The input is a digit\n"; & } & else if(q<='z' && q>='a'){ cout <<"The input is a lower case letter\n"; } & else if(q<='Z' && q>='A'){ cout <<"The input is an upper case letter\n"; } & else{ cout<<"The input is a special symbol"& ; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment