Cod sursa(job #27714)
| Utilizator | Data | 6 martie 2007 23:22:48 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.37 kb |
#include<stdio.h>
#include<iostream.h>
char c;
int lit,cuv,space;
double total;
int main(void) {
FILE *in=fopen("text.in","rt"),*out=fopen("text.out","w+");
while( fscanf(in,"%c",&c)!=EOF){
if((c>=65 && c<=90) || (c>=97 && c<=122)) {
lit=lit+1;
space=0;
}
else if(c==32) space=1;
if (space) cuv=cuv+1;
}
total=lit/(cuv+1);
fprintf(out,"%D",total);
}