Pagini recente » Cod sursa (job #2267551) | Cod sursa (job #1252042) | Cod sursa (job #2324633) | Cod sursa (job #1699356) | Cod sursa (job #1247425)
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int sum;
string text;
char *pointer;
int main() {
getline(f, text);
int length = text.length(), i = 0, no = 0, sum = 0;
const char *pointer = text.c_str();
while(i < length)
{
if(isalpha(pointer[i]))
no++;
while(isalpha(pointer[i]))
{
sum++;
i++;
}
i++;
}
g << sum / no;
f.close();
g.close();
return 0;
}