Cod sursa(job #1028841)

Utilizator buzaturazvanbuzatu marin razvan buzaturazvan Data 14 noiembrie 2013 19:01:22
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <fstream>
#include<string.h>
using namespace std;

int main()
{
    ifstream f1("text.in");
    int long i=0,s=0,ok=0;
    char ch;
    while(!f1.eof())
    {
        f1.get(ch);
        if( ((ch >= 'a' ) && (ch <= 'z' )) || ((ch >= 'A' ) && (ch <= 'Z')))
        i++;
        if(i>0)
            ok=1;
        if(ok==1)
        {
            if(ch== ' ' )
                s++;
            if(ch== '-')
                    s++;
        }
    }
    f1.open("text.in");
    ofstream f2("text.out");
    s++;
    f2<<i/s;


}