Cod sursa(job #29337)
| Utilizator | Data | 9 martie 2007 08:30:21 | |
|---|---|---|---|
| Problema | Text | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 kb |
#include"fstream.h"
#include"string.h"
int main()
{
char l[2];
int lit=0,cuv=0,med=0,aux=0;
ifstream in("text.in");
ofstream out("text.out");
while(!in.eof())
{
in.get(l,2);
if((strcmp(l,"a")>=0 && strcmp(l,"z")<=0) || (strcmp(l,"A")>=0 && strcmp(l,"Z")<=0))
{
lit++;
}
else
if(lit)
{
cuv++;
aux+=lit;
lit=0;
}
else
lit=0;
}
med=aux/cuv;
out<<med;
in.close();
out.close();
return 0;
}
