Cod sursa(job #1567792)
Utilizator | Andrei Cotor Andrei_Cotor | Data | 13 ianuarie 2016 19:01:07 |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<stdio.h>
#include<string.h>
using namespace std;
FILE *fi,*fo;
int i,lit,nrcuv;
char A[10000];
char *pch;
int main()
{
fi=fopen("text.in","r");
fo=fopen("text.out","w");
for(i=0; i<10000; i++)
{
fscanf(fi,"%c",&A[i]);
}
pch=strtok(A," .?!,-");
while(pch!=NULL)
{
nrcuv++;
lit=lit+strlen(pch);
pch=strtok(NULL," .?!,-");
}
fprintf(fo,"%d",lit/nrcuv);
fclose(fi);
fclose(fo);
return 0;
}