Cod sursa(job #2069126)
Utilizator | Data | 18 noiembrie 2017 12:05:27 | |
---|---|---|---|
Problema | Text | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
char s [500];
int lungime = 0, numarCuv = 0, n;
while (f >> s){
numarCuv++;
n = strlen(s);
for (int i = 0; i < n; i++)
if (isalpha(s[i]) || isdigit(s[i]))
lungime++;
}
g << lungime/numarCuv;
return 0;
}