Pagini recente » Cod sursa (job #2293460) | Istoria paginii runda/prega_oni2015_9/clasament | Cod sursa (job #1857564) | Cod sursa (job #1791179) | Cod sursa (job #783664)
Cod sursa(job #783664)
#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;
}