Cod sursa(job #288170)
| Utilizator | Data | 25 martie 2009 16:51:01 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.53 kb |
#include<fstream.h>
#include<ctype.h>
unsigned int aux,c,litere,cuvinte,medie;
main()
{
ifstream In("text.in");
ofstream Out("text.out");
In>>c;
if(isalpha(c)) {litere++;cuvinte++;}
aux=c;
while(!In.eof())
{
In>>c;
if(isalpha(c)) litere++;
if(isalpha(c) && !isalpha(aux)) cuvinte++;
aux=c;
}
In.close();
if(!litere || !cuvinte) Out<<medie<<'\n';
else
{
medie=litere/cuvinte;
Out<<medie<<'\n';
}
Out.close();
return 0;
}
