101
{ USER }
posts: 55
last: 09-Apr-2008
TITLE: Display the number of Words and Characters Entered
DESCRIPTION: Shows the number of words and characters entered by a users input
Submitted: 09-Apr-2008 10:12:20 ( 38w 5d 19h ago ) Language: C++ (*.cpp *.h)
Views: 115 Lines of Code: 34 LINES
Rating:
rate: star1
star2
star3
star4
star5
dstar1
dstar2
dstar3
dstar4
dstar5  ( rated! )
  { 0.00 / 5 }
Difficulty: Beginner
Bookmark
/* Author: 101
   Date: 09-04-2008
   Filename: 
   Description: Shows the number of wrods and characters entered
   History: 
*/



#include<iostream.h>
#include<conio.h>

main()
{
  int chcount=0;
  int wdcount=1;
  char ch;

  clrscr();
  cout<<"\n \n This program will count the number of characters and words that u have entered";
  cout<<"\n Type whaterver u like to followed by an enter ....\n\n";

  while ((ch=getche())!='\r')
  {
     if(ch==' ')
	wdcount++;
     else
	chcount++;
  }

  cout<<"\n\n The number of words are : "<<wdcount<<endl;
  cout<<"\n The number of characters are : "<<chcount<<endl;
  getch();
}