Thursday, March 15, 2007

Ogvvlberees vg tooloh algoritm




#include<conio.h>


#include<stdio.h>


#include<string.h>


void main()


int word=0,sLength,m=1;


char *sentence;


char buffer[256];


sentence=buffer;


puts("Please insert any sentence:");


gets(sentence);


strcat(sentence," ");


sLength=strlen(sentence);


while (m<sLength)


if(sentence[m]==' ')


if(sentence[m-1]!=' ')


word=word+1;


m++;


printf("There are %d words in this sentence.\n",word);


getch();

No comments: