THIS IS THE PROGRAM HOW YOU CAN BUILD A WORD COUNTER USING C++ PROGRAMMING LANGUAGE
For that first you need to watch our YouTube video for explanation ..
Here is the link:- WATCH VIDEO
program:-
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int wdcount = 1,chcount=0;
char ch;
cout << "write a sentence: ";
while ((ch = _getche()) !='\r')
{
if (ch == ' ')
wdcount++;
else
chcount++;
}
cout << "\nwords= " << wdcount << endl;
cout << "letters= " << chcount << endl;
_getch();
}
output:-
Comments
Post a Comment