.Any character is entered via the keyboard, write a program to decide whether or not the character entered is a capital letter, a small case letter, a digit or a exclusive symbol. Please seek advice from ASCII Chart.


#include<iostream>
using namespace std;

int main ()
{
char ch;
cout<<"Enter any character:";
cin>>ch;

if (ch>=65 && ch<=90)
cout<<"Character is a capital letter";
else if (ch>=97 && ch<=122)
cout<<"Character is a small letter";
else if (ch>=48 && ch<=57)
cout<<"Character is a digit";
else if ((ch>0 && ch<=47)||(ch>=58 && ch<=64)||
               (ch>=91 && ch<=96)||(ch>=123 && ch<=127))
cout<<"Character is a special symbol";
return 0;


1 comments:

  1. Write a C++ program that reads 4 numbers from the user and then print
    largest and smallest number on the screen
    Example: User entered 11, 2, 15, 34
    then program should print: Largest = 34, Smallest = 2
    answer please!

    ReplyDelete

If You Have Any Problem While Downloading Comment Below

 
Top