Cod sursa(job #2016975)

Utilizator skoda888Alexandru Robert skoda888 Data 30 august 2017 23:45:24
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <iostream>
#include <fstream>
#include <string>

int main()
{
    std::ifstream in("text.in");
    std::ofstream out("text.out");
    int nc = 0;
    int nl = 0;
    std::string l;
    bool c = false;
    while(!in.eof())
    {
        std::getline(in, l, '\0');
        for(int i = 0; i <= l.size(); i++)
        {
            if(l[i] >= 'a' && l[i] <= 'z')
                {nl++;
                c = true;}
            else if(l[i] >= 'A' && l[i] <= 'Z')
                {nl++;
                c = true;}
            else{
                if(c == true)
                    c = false;
                    nc++;
            }
        }

    }
    out<< nl / nc;
    return 0;
}