Cod sursa(job #569533)
| Utilizator | Data | 1 aprilie 2011 17:31:20 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | 104 | Marime | 0.49 kb |
#include <stdio.h>
#include <string.h>
FILE *f=fopen("text.in","r");
FILE *g=fopen("text.out","w");
int main(void){
register int i;
char ch;
bool ok;
int nrl=0,nrc=0;
while(!feof(f)){
fscanf(f,"%c",&ch);
int cod=ch;
if((cod>=65 && cod<=90) || (cod>=97 && cod<=122)){
nrl++;
ok=true;
}
else if(cod<65 || (cod>90 && cod<97) || cod>122){
if(ok){
ok=false;
nrc++;
}
}
}
if(ok)
nrc++;
fprintf(g,"%d",nrl/nrc);
return 0;
}