Cod sursa(job #874157)

Utilizator gerd13David Gergely gerd13 Data 7 februarie 2013 22:36:46
Problema Text Scor 30
Compilator cpp Status done
Runda cnlr_camp Marime 0.37 kb
#include<fstream>
using namespace std;
int main()

{
ifstream fin("text.in");
ofstream fout("text.out");
int litera=0, cuvant=0, suma=0, medie;
char s;
while(fin.get(s))
{
if(('a'<s && s<='z')||('A'<=s && s<='Z'))
litera++;
else
{
if(litera)
cuvant++;
suma=suma+litera;
litera=0;
}
}
medie=suma/cuvant;
fout<<medie;
fin.close();
fout.close();
return 0;
}