Cod sursa(job #1994358)
Utilizator | Data | 24 iunie 2017 19:38:00 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <iostream>
#include<fstream>
using namespace std;
int main()
{
ifstream fin ("text.in");
ofstream fout ("text.out");
char litera;
int cuvinte = 0;
int toateliterele = 0;
bool cuvant = false;
while(fin)
{
fin.get(litera);
if( (litera>='a' && litera<='z') || (litera>='A' && litera<='Z') )
{
if(!cuvant))
cuvinte++;
toateliterele++;
}
else
{
cuvant = false;
}
}
fout << cuvinte/toateliterele;
return 0;
}