Cod sursa(job #405331)
Utilizator | Data | 27 februarie 2010 21:37:00 | |
---|---|---|---|
Problema | Text | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<stdio.h>
#include<string.h>
FILE*f=fopen("text.in","r");
FILE*g=fopen("text.out","w");
int litere,cuvinte,s,c,i;
char ok,x;
int main () {
while(fscanf(f,"%c",&x)!=EOF){
if(('A'<=x&&'Z'>=x)||('a'<=x&&'z'>=x)){
litere++;
ok=1;
}
else{
if(ok==1){
cuvinte++;
ok=0;
}
}
}
fprintf(g,"%d",litere/cuvinte);
fclose(f);
fclose(g);
return 0;
}