Cod sursa(job #533263)
| Utilizator | Data | 13 februarie 2011 16:28:27 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include<fstream>
#include<string.h>
using namespace std;
#define EsteLitera(l) ((l>='a'&&l<='z')||(l>='A'&&l<='Z'))
int main()
{ char l;int suma=0,s=0,ct=0;
ifstream fin("text.in");
while(!fin.eof())
{
s=0;
do
{
fin.get(l);
if(fin.eof()) break;
if(EsteLitera(l)) s++;
}while(EsteLitera(l));
if(s!=0)
{
suma=suma+s;
ct++;
}
}
fin.close();
ofstream fout("text.out");
fout<<suma/ct;
fout.close();
return 0;
}