Write a C++ Program to count chars, line, word into it.
#include
#include
#include
#define MAX_ROW 5
#define MAX_COL 80
void main(){
char name[MAX_ROW][MAX_COL],c;
int lines=1; //bcoz. first line will be left to count.
int words=1; //bcoz. first word will be left to count.
int chars=1; //bcoz. first char will be left to count.
clrscr();
cout<<"===Input Status===\n";
cout<<"Enter string termanate by # : ";
cin.get(c);
//Finding no. of lines
while(c != '#'){
cin.get(c);
chars++;
if(c==' ' || c=='\n')
words++;
if(c=='\n')
lines++;
}
cout<<"\n"<
cout<<"-------------------------------------\n";
cout.setf(ios::left,ios::adjustfield);
cout<<"\n"<
cout.setf(ios::right,ios::adjustfield);
cout<
cout.setf(ios::left,ios::adjustfield);
cout<<"\n"<
cout.setf(ios::right,ios::adjustfield);
cout<
cout.setf(ios::left,ios::adjustfield);
cout<<"\n"<
cout.setf(ios::right,ios::adjustfield);
cout<
getch();
}