Cod sursa(job #2242197)

Utilizator bori2000Fazakas Borbala bori2000 Data 18 septembrie 2018 08:08:09
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.79 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=true;
    int karak=0, szodb=0;
    for(int i=0; i<=s.length()-1; i++)
    {
        x=s[i];
        //cout<<x<<endl;
        if(x>='A' and x<='Z' or x>='a' and x<='z')
        {
            karak++;
            if(!szo) szo=true;
        }
        else if(szo)
        {
            //cout<<x<<endl;
            szodb++;
            szo=false;
        }
    }
    //cout<<karak<<endl<<szodb<<endl;
    double ered= (double)karak/(double)szodb;
    double int_ered;
    double y = modf(ered, &int_ered);
    g<<int_ered<<endl;
    return 0;
}