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