PROGRAM
Program to count number of characters entered.#include<iostream.h>
#include<conio.h>
int main()
{ clrscr();
int chcount = 0;
const char ent = '\n';
char ch;
cout<<"Enter character\n";
cin.get(ch);
while(ch!=ent)
{
chcount++;
cout.put(ch);
cin.get(ch);
}
cout<<"\nThe number of characters = "<<chcount<<"\n";
getch();
return 0;
}
========================================================================
OUTPUT
Enter character
Bhavesh Poptani
Bhavesh Poptani
The number of characters = 15
========================================================================
No comments:
Post a Comment