Cod sursa(job #1599717)

Utilizator gorni97aaa aaa gorni97 Data 14 februarie 2016 11:56:31
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int main()

{char c;
int total=0,cuv=0,OK=0;
fstream f("text.in",ios::in);
fstream g("text.out",ios::out);


while(!f.eof())
{f.get(c);

if(isalpha(c))
    total++;


if((OK==0)&&(isalpha(c)))
{cuv++;
OK=1;
}
else
if((OK==1)&&(!isalpha(c)))
OK=0;

}

g<<total/cuv;

g.close();
f.close();

}