I wanted these explanations for a problem:"i have to write how many word has each sentence.A sentence is a string until she meet '\n'.
this is the code:
Code:
#include <stdio.h>
#include <string.h>
int elitera(char litera);
int main ()
{
FILE *poz;
char s[50];
int i,nrword=0;
poz=fopen("text.txt","r");
while (feof(poz)==0)
{
fgets(s,50,poz);
++nrword;
fputs(s,stdout);
for (i=1;i<strlen(s);++i)
{
if ( (elitera(s[i-1])==0) && (elitera(s[i])==1) )
++nrword;
}
printf("%d\n",nrword);
nrword=0;
}
getch();
}
int elitera(char litera)
{
litera=toupper(litera);
if ( (litera>='A') && (litera<='Z'))
return 1;
else
return 0;
}
I have not yet put your advice into practice
s well as I do here?
I hope you understand