Cod sursa(job #29284)
Utilizator | Lobont Andrei JacKtHeRIpEr | Data | 8 martie 2007 20:54:20 |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.55 kb |
#include"fstream.h"
int main()
{
ifstream f("text.in");
ofstream o("text.out");
unsigned long lit=0;
unsigned int cuv=0, i;
char l[30];
while(!f.eof())
{
f>>l;
if(l[0]>='a' && l[0]<='z' || l[0]>='A' && l[0]<='Z')
{
cuv++;
for(i=0;i<strlen(l);i++)
if(l[i]>='a' && l[i]<='z' || l[i]>='A' && l[i]<='Z')
lit++;
else
if(i<strlen(l)-1)
cuv++;
}
}
o<<lit/cuv;
f.close();
o.close();
return 0;
}