Pagini recente » Cod sursa (job #1531834) | Cod sursa (job #1813974) | Cod sursa (job #2677446) | Cod sursa (job #1166381) | Cod sursa (job #783665)
Cod sursa(job #783665)
#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';
fout << nrl/nrc << '\n';
return 0;
}
bool Check(char character)
{
if ( character >= 'A' && character <= 'Z' )
return true;
if ( character >= 'a' && character <= 'z' )
return true;
return false;
}