Cod sursa(job #1362774)

Utilizator hantescuHantascu Alexandru hantescu Data 26 februarie 2015 15:21:46
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.89 kb
/*#include <iostream>
#include <fstream>
#include <cstring>

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

int main()
{
    char v[251], *p;
    while(!f.eof())
    {
        f.getline(v,251);
        p=strstr(v,"-");
        //strcpy(v+,);
        g<<v<<" ";
    }
    return 0;
}*/
#include <fstream>
using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");

char x;
int nrl, nrc;
bool cuv = false;

int main()
{
    while ( !fin.eof() )
    {
        x = fin.get();
        if ( (x >= 'a' && x <= 'z') || ( x >= 'A' && x <= 'Z') )
        {
            nrl++;
            if ( cuv == false )
            {
                nrc++;
                cuv = true;
            }
        }
        else
            cuv = false;
    }
    int m = nrl / nrc;
    fout << m;
    fin.close();
    fout.close();
    return 0;
}