Mai intai trebuie sa te autentifici.
Cod sursa(job #28186)
| Utilizator | Data | 7 martie 2007 16:20:04 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include<stdio.h>
#include<iostream.h>
char c;
int lit,cuv,space;
int 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 || c==33 || c==63 || c==46 || c==44) space=1;
if (space) cuv=cuv+1;
}
//cuv=cuv+1;
total=(float)lit/cuv;
cout<<"litere: "<<lit<<endl;
cout<<"cuvinte: "<<cuv<<endl;
cout<<"litere/cuvinte: "<<total<<endl;
fprintf(out,"%d",total);
}
