Cod sursa(job #1514354)
| Utilizator | Data | 31 octombrie 2015 00:55:37 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.64 kb |
#include <stdio.h>
using namespace std;
int main()
{
int OK=0,length = 0,nr=0;
char character;
FILE * f= fopen("text.in","r");
FILE *g = fopen("text.out","w");
//fstream f("text.in");
//ofstream g("text.out");
while(fscanf(f,"%c",&character)>0){
// while(!f.eof()){
//f.get(character);
if((character>='a' && character<='z') || (character>='A' && character<='Z')){
OK = 1;
length++;
}
else if((OK==1)){
nr++;
OK = 0;
}
}
///g<<length/nr;
fprintf(g,"%d",length/nr);
return 0;
}
