Cod sursa(job #2221534)

Utilizator beatrice01Ferco Beatrice beatrice01 Data 14 iulie 2018 17:58:23
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.65 kb
#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[1000], mat[100][30], sep[] = "-., :!;?/'_<>()[]{}|#1234567890", *p;
int n = 0, total = 0;

int main()
{
	fin.getline(a, 1000);
	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";
	fout << (total) / n;
	system("pause");
	return 0;
}