Cod sursa(job #783664)

Utilizator SeekHunt1334Septimiu Bodica SeekHunt1334 Data 3 septembrie 2012 15:27:04
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.87 kb
#include <iostream>
#include <cstdio>
#include <fstream>
using namespace std;

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

bool Check(char character);

int nrc, nrl;
bool found = false;
char thischar;


int main()
{
    thischar = fin.get();

    while ( thischar != '\n' )
    {
        if ( Check(thischar) )
        {
            found = true;
            nrl++;
        }
        else
        if (found == true)
        {
            found = false;
            nrc++;
        }

        thischar = fin.get();
    }
    if (found == true)
        nrc++;


    cout << nrl << ' ' << nrc << '\n';
    cout << nrl/nrc;

    return 0;
}

bool Check(char character)
{
    if ( character >= 'A' && character <= 'Z' )
        return true;
    if ( character >= 'a' && character <= 'z' )
        return true;
    return false;
}