Pagini recente » Borderou de evaluare (job #2188519) | Borderou de evaluare (job #2829842) | Borderou de evaluare (job #1001438) | Borderou de evaluare (job #2006746) | Cod sursa (job #1864813)
#include <fstream>
#include <iostream>
#include <string.h>
using namespace std;
bool lit(char x)
{
if (x >= 'A' && x <= 'Z')
return 1;
if (x >= 'a' && x <= 'z')
return 1;
return 0;
}
int main()
{
ifstream e("text.in");
ofstream g("text.out");
int nr = 0;
int c = 0;
char x;
e >> noskipws >> x;
char p = x;
if (lit(x) == 1)
{
nr++;
c++;
}
while (e >> noskipws >> x)
{
if (lit(x) == 1)
c++;
if (lit(x) == 1 && lit(p) == 0)
nr++;
p = x;
}
g << c / nr;
e.close();
g.close();
return 0;
}