Pagini recente » Profil georeginfoarena | Cod sursa (job #3166469) | Cod sursa (job #1003498) | Cod sursa (job #86818) | Cod sursa (job #113324)
Cod sursa(job #113324)
#include <stdio.h>
#include <string.h>
FILE *f,*g;
char s[10000],*p,s1[10000],s2[10000];
int t,m;
int main ()
{f=fopen("TEXT.IN","r");
g=fopen("text.out","w");
fgets(s,9990,f);
while (!feof(f))
{fgets(s1,9990,f);
strcat (s,s1);
if (strcmp(s1,s2)==0)break;
else strcpy(s2,s1); }
p=strtok(s," ;,./-'`!?\n");
{t+=strlen(p); m++;}
while ((p=strtok(NULL," ;,!?./-'`\n"))!=NULL)
{t+=strlen(p); m++;}
m=t/m;
fprintf(g,"%d",m);
fclose(f);
fclose(g);
return 0;}