Cod sursa(job #1342812)

Utilizator ccsgeorge1Cocis George ccsgeorge1 Data 14 februarie 2015 15:55:55
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 nr=0, nri=0, k, v[1000];
bool ok;
int main()
{
    ifstream f ("text.in");
    ofstream g ("text.out");
    while (!f.eof())
    {
        getline (f,s);
        for (int i=0;i<=s.length();i++)
        {
            if (isalpha(s[i]))
            {
                nr++;
                ok=true;
            }
            if (!isalpha(s[i+1]) && ok)
            {
                nri++;
                ok=false;
            }
        }
    }
    g<<nr/nri;
    return 0;

}