Cod sursa(job #1873068)
Utilizator | Popescu Octavian omniped | Data | 8 februarie 2017 19:28:34 |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int main()
{
char p;
int nr_cuvinte = 0, lungime = 0;
ifstream fin("C:\\Users\\Danut\\Desktop\\in.txt");
ofstream fout("C:\\Users\\Danut\\Desktop\\out.txt");
while ( fin>>noskipws>>p)
{
if ((p >= 'A' && p <= 'Z') || (p >= 'a' && p <= 'z'))
lungime++;
if (p == ' ' || p==' \n' || p=='\n')
nr_cuvinte++;
}
fout << lungime / (nr_cuvinte + 1);
fin.close();
fout.close();
}