Friday, May 21, 2010

Simple C program plz help?

#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


#include%26lt;string.h%26gt;


void main()


{


char name[50];


int i,count=0, j;


clrscr();


printf("Enter your name:");


gets(name);


count=strlen( name);


printf("no. of characters entered = %d",count);








getch();


}








this is program in which we give characters and it is counted by statements...


plz make it like this Using getche(); function in which we input infinite chartacters and after pressing enter it show u how many words u entered not characters its WORDS..plz help

Simple C program plz help?
int countWords=0;


if(count%26gt;0)


{


countWords++;


}


for(i=0;i%26lt;count;i++)


{


if(name[i]==" ")


{


countWords++;


}


}
Reply:How do you find a word? You check each character looking for a space, comma, period, exclamation mark, question mark, semi colon, colon, new line, or tab (I think that is all).





There is an example in Kernighan and Ritchie on page 20.

potential breakup song

No comments:

Post a Comment