Cod sursa(job #531481)
Utilizator | Gravila Felix fgravila | Data | 9 februarie 2011 19:21:55 |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
int lungime,numar;
int ischar(char x){
if(x>=65 and x<=90 ) return 1;
if(x>=97 and x<=122) return 1;
return 0;
}
void proces(){
ifstream in("text.in");
char c[20];
while(in>>c){
lungime++;
for(int i=0;i<strlen(c);i++)
if(ischar(c[i]))numar++;
}
in.close();
}
int main(){
proces();
ofstream out("text.out");
out<<numar/lungime;
out.close();
return 0;
}