Cod sursa(job #179826)
Utilizator | Data | 16 aprilie 2008 13:18:02 | |
---|---|---|---|
Problema | Text | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include<fstream.h>
#include<stdio.h>
int main()
{
ifstream fin("text.in");
ofstream fout("text.out");
char x;
int c=0,nr_l=0,nr_c=1;
while (fin.get(x))
{
nr_l+=(x>='A' && x<='Z' || x>='a' && x<='z');
if (c && x==' ') nr_c++;
c=x!=' ';
}
fout<<nr_l/nr_c;
fin.close();
fout.close();
return 0;
}