Mai intai trebuie sa te autentifici.
Cod sursa(job #1506329)
Utilizator | Data | 20 octombrie 2015 14:48:28 | |
---|---|---|---|
Problema | Text | Scor | 30 |
Compilator | c | Status | done |
Runda | Arhiva de probleme | Marime | 0.56 kb |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
int k=-1,s2=0,s1=0,o=0;
char s[1000],*p,c;
FILE *f,*g;
f=fopen("text.in","r");
g=fopen("text.out","w");
while(!feof(f)){
fscanf(f,"%c",&c);
k++;
s[k]=c;
}
p=strtok(s," -?.,!\n");
while(p!=NULL){
s1=strlen(p);
s2+=s1;
o++;
printf("%s %d %d \n",p,s1,s2);
p=strtok(NULL," -?.,!\n");
}
printf("%d\n",s2);
printf("%d\n",o);
fprintf(g,"%d",s2/o);
return 0;
}