Cod sursa(job #2243291)

Utilizator bori2000Fazakas Borbala bori2000 Data 20 septembrie 2018 11:44:32
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.83 kb
#include <iostream>
#include <fstream>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    string s;

    char x;
    ifstream f("text.in");
    ofstream g("text.out");

    getline(f, s);

    bool szo=false;
    int karak=0, szodb=0;
    for(int i=0; i<=s.length()-1; i++)
    {
        x=s[i];
        if((x>='A' and x<='Z') or (x>='a' and x<='z'))
        {
            karak++;
            if(!szo) szo=true;
        }
        else
        {
            //cout<<x<<endl;
            if(szo)
            {
                //cout<<x<<endl;
                szodb++;
                szo=false;
            }
        }
    }
    //cout<<karak<<endl<<szodb<<endl;
    int ered= karak/szodb;
    double int_ered;
    double y = modf(ered, &int_ered);
    g<<ered<<endl;
    return 0;
}