Pagini recente » Cod sursa (job #2523692) | Cod sursa (job #1418699) | Borderou de evaluare (job #1512670) | Cod sursa (job #379168) | Cod sursa (job #2344235)
#include <fstream>
#include <cctype>
using namespace std;
int main()
{
ifstream input("text.in");
int words = 0, len = 0;
char c;
bool ok = true;
while(input.get(c))
{
if (isalpha(c))
{
if(!ok)
words++;
len++;
ok = false;
} else ok = true;
}
int result = 0;
if (words)
result = len / words;
ofstream output("text.out");
output << result;
return 0;
}