Cod sursa(job #1222128)
Utilizator | Data | 22 august 2014 12:22:45 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.55 kb |
#define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
using namespace std;
FILE *textin = fopen("in.txt", "r");
FILE *textout = fopen("out.txt", "w");
int c = 0, n = 0, g = 1;
char ch;
int main()
{
while (!feof(textin))
{
ch = fgetc(textin);
if (isalpha(ch))
{
while (isalpha(ch))
{
ch = fgetc(textin);
c++;
}
n++;
}
}
fclose(textin);
g = (int)c / n;
printf("\n%d\n", g);
fprintf(textout, "%d", g);
fclose(textout);
return 0;
}