Cod sursa(job #1499088)

Utilizator paul_turbo07Alungei Paul paul_turbo07 Data 10 octombrie 2015 09:54:06
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
string s;
int n,i,nl,nc;
bool ok;
int main()
{
    ifstream f("text.in");
    ofstream g("text.out");
    while (!f.eof())
    {
        getline (f,s);
        n= s.size();
        for (i=0;i<=n-1;i++)
        {
            if (isalpha(s[i]))
            {
                nl++;
                ok=true;
            }
            if ((!isalpha(s[i+1])) && ok)
            {
                ok=false;
                nc++;
            }
        }
    }
    g<<nl/nc;
    return 0;
}