Cod sursa(job #2243299)

Utilizator bori2000Fazakas Borbala bori2000 Data 20 septembrie 2018 11:51:55
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <iostream>
#include <fstream>
#include <math.h>
#include <string>


using namespace std;

int main()
{
    ifstream f("text.in");
    ofstream g("text.out");

    string s;
    bool found;
    int karak=0;
    int szodb=0;

    while(f>>s)
    {
        for(int i=0; i<=s.length()-1; i++)
        {
            if(isalpha(s[i]))
            {
                found=true;
                karak++;
            }
        }
        if(found) szodb++;
    }

    g<<karak/szodb<<endl;

    return 0;
}