Thursday, 20 March 2014

PROGRAM IN C++ TO COUNT THE NUMBER OF CHARACTERS ENTERED BY USER..

// count number of characters entered
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int count=0;
const char ent=’\n’;
char ch;
cout<<”enter character\n”;
cin.get(ch);
while(ch!=ent)
{
count++;
cout.put(ch);
cin.get(ch);
}
cout<<”\n the number of characters=”<<count<<”\n”;
getch();
}
Image

No comments:

Post a Comment