Cod sursa(job #1726968)

Utilizator cella.florescuCella Florescu cella.florescu Data 9 iulie 2016 16:44:47
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <cstdio>
#include <cctype>

using namespace std;

int main()
{
    FILE *fin, *fout;
    int cuv, lit, stare;
    char ch;
    fin=fopen("text.in", "r");
    cuv=lit=stare=0;
    ch=fgetc(fin);
    while(ch!=EOF){
      if(isalpha(ch)){
        ++lit;
        stare=1;
      } else{
        if(stare)
          ++cuv;
        stare=0;
      }
      ch=fgetc(fin);
    }
    fclose(fin);
    fout=fopen("text.out", "w");
    fprintf(fout, "%d\n", lit/cuv);
    fclose(fout);
    return 0;
}