Pagini recente » Cod sursa (job #598788) | Cod sursa (job #2287916) | Cod sursa (job #178506) | Cod sursa (job #1026501) | Cod sursa (job #2221538)
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string.h>
#include <ctype.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char a[105], mat[105][30], sep[] = "+*=^&%$@`\"-., :!;?/'_<>()[]{}|#1234567890\n", *p;
int n = 0, total = 0;
int main()
{
while (fin.getline(a, 100)) {
p = strtok(a, sep);
while (p)
{
strcpy(mat[n], p);
//cout << mat[n] << "\n";
//for (int i = 0; i<strlen(mat[n]); i++)
// if(isalpha(mat[n][i])) total++;
total += strlen(mat[n]);
n++;
p = strtok(NULL, sep);
}
}
//cout << total << " " << n << "\n";
if (n == 0) fout << "0";
else
fout << total / n;
//system("pause");
return 0;
}