Cod sursa(job #521381)
Utilizator | Data | 12 ianuarie 2011 11:25:51 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include<stdio.h>
FILE *in,*out;
long int i,litere,cuvinte;
char c,c_ant;
int main()
{
in=fopen("text.in","rt");
out=fopen("text.out","wt");
while(!feof(in))
{
fscanf(in,"%c",&c);
if(c>=65 && c<=90 || c>=97 && c<= 122)
litere++;
else
if(c_ant>=65 && c_ant<=90 || c_ant>=97 && c_ant<=122)
cuvinte++;
c_ant=c;
};
if(c_ant>=65 && c_ant<=90 || c_ant>=97 && c_ant<=122)
cuvinte++;
if(cuvinte)
fprintf(out,"%d",litere/cuvinte);
else
fprintf(out,"0");
return 0;
}