You are on page 1of 1

Write a program will count the number of characters and space and

numerical values and special characters.


============================================
#include <conio.h>
#include <iostream.h>
void main()
{
clrscr();

int alpha=0,numerical=0,space=0,special=0;
char c;

cout<<"\n\nEnter Your Line..."<<endl;


while ((c=getche())!='\r')
{
if ((c>=65&&c<=90)||(c>=97&&c<=122))
alpha++;
else if (c>=48&&c<=57)
numerical++;
else if (c==32)
space++;
else
special++;
}

cout<<"\n\nCharacters= "<<alpha;
cout<<"\n\nNumerical Values= "<<numerical;
cout<<"\n\nSpaces= "<<space;
cout<<"\n\nSpecial Characters= "<<special;

getch();
}

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006