Cod sursa(job #898951)
| Utilizator | Data | 28 februarie 2013 12:17:02 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include<fstream>
#include<stdio.h>
using namespace std;
FILE *f=fopen("text.out","r");
FILE*g=fopen ("text.in","w");
char l1,l2;
int nr,nr1;
int main(){
fscanf (f,"%c",l1);
while (fscanf (f,"%c",l2)!=EOF){
if (l2>='a'&&l2<='z'||l2>='A'&&l2<='z'){
nr1++;
}
else{
nr++;
while (!(l1>='a'&&l1<='z'||l2>='A'&&l2<='z')){
if (fscanf (f,"%c",l1)==EOF)
break;
}
nr1++;
}
}
fprintf(g,"%d",nr1/nr);
return 0;
}
