Cod sursa(job #1251397)

Utilizator vladia13Ungureanu Adrian vladia13 Data 29 octombrie 2014 13:38:10
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.67 kb
#include <fstream>

using namespace std;

ifstream f("text.in");
ofstream g("text.out");

int nrl,nrc,ok;
char x,y;

int main()
{
    nrl = 0;
    nrc = 0;
    while(f.get(x))
    {

        if((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z'))
            {
                nrl++;
                ok = 1;
            }

        if(x == '-' && nrl > 0 && ok == 1)
            {
                nrc++;
                ok = 0;
            }

        if(x == ' ' && nrl > 0 && ok == 1)
            {
                nrc++;
                ok = 0;
            }

        if(x == '\n')
            nrc++;
    }

    g<<nrl/nrc;

    return 0;
}