Cod sursa(job #2288219)

Utilizator MIGAAndrei Miga MIGA Data 22 noiembrie 2018 22:42:02
Problema Text Scor 0
Compilator c-64 Status done
Runda Arhiva de probleme Marime 0.74 kb
#include <stdio.h>

int main()
{
    int NumarLitere = 0, NumarCuvinte = 0;
    char c, lastchar = -1;
    FILE* fin, *fout;
    fin = fopen("text.in", "r");
    c = fgetc(fin);
    while (c != EOF)
    {
        if (c >= 65 && c <= 90 || c >= 97 && c <= 122)
            NumarLitere++;
        if (!(c >= 65 && c <= 90 || c >= 97 && c <= 122) && (lastchar >= 65 && lastchar <= 90 || lastchar >= 97 && lastchar <= 122))
            NumarCuvinte++;
        lastchar = c;
        c = fgetc(fin);
    }
    if (lastchar >= 65 && lastchar <= 90 || lastchar >= 97 && lastchar <= 122)
        NumarCuvinte++;
    fclose(fin);
    fout = fopen("text.out", "w");
    fprintf("%d", NumarLitere / NumarCuvinte);
    fclose(fout);
    return 0;
}