Pagini recente » Cod sursa (job #809379) | Cod sursa (job #496279) | Cod sursa (job #830391) | Cod sursa (job #1192815) | Cod sursa (job #1250901)
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream f ("text.in");
ofstream g ("text.out");
char c;
int nrcuv = 0, nrlit = 0;
bool ok = 0;
f.get(c);
while ((c < 'A') || ((c > 'Z') && (c < 'a')) || (c >'z'))
f.get(c);
while (f.get(c))
{
cout << c;
if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')))
{
nrlit++;
ok = 1;
}
else
{
if (ok == 1)
nrcuv++;
ok = 0;
}
}
if (ok == 1)
nrcuv++;
g << nrlit / nrcuv;
return 0;
}