Cod sursa(job #1890822)
| Utilizator | Data | 23 februarie 2017 15:43:36 | |
|---|---|---|---|
| Problema | Text | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <fstream>
#include <iostream>
#include <ctype.h>
using namespace std;
ofstream g("text.out");
int main()
{
ifstream fin;
fin.open("text.in", ios:: in);
char caracter_curent = '\0';
int lungime_totala = 0, nr_cuvinte = 0;
while (!fin.eof())
{
fin.get(caracter_curent);
if (isalpha(caracter_curent))
++lungime_totala;
else if (lungime_totala != 0)
++nr_cuvinte;
}
g << lungime_totala / nr_cuvinte;
return 0;
}