Cod sursa(job #1588023)

Utilizator ruxandramateiMatei Ruxandra ruxandramatei Data 2 februarie 2016 19:00:51
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <iostream>
#include <fstream>

using namespace std;

ifstream in("text.in");
ofstream out("text.out");

int main(){
    char c;
    int k=0,p=0,ok=0;

    while(!in.eof()){
        in.get(c);
        ok=0;
        if((c>='a' && c<='z')||(c>='A' && c<='Z')){
          ok=1;
          k++;
        }
        while(!in.eof() && (c>=65 && c<=90) || (c>=97 && c<=122)){
            in.get(c);
            if((c>='a' && c<='z')||(c>='A' && c<='Z')){
              k++;
            }
        }
        if(ok==1)p++;
    }
    out<<k/p;
    return 0;
}