Cod sursa(job #1494174)

Utilizator Y0da1NUME JMECHER Y0da1 Data 30 septembrie 2015 19:42:08
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.71 kb
#include <fstream>
//#include <iostream>
#include <sstream>
#include <string.h>
using namespace std;
int main()
{
    char c;
    int l=0, gasit=0, nr=0, i;
    ifstream g ("text.in");
    ofstream h ("text.out");
    stringstream buffer;
        buffer << g.rdbuf();
    string contents(buffer.str());
    for(i=0;i<strlen(contents.c_str());i++)
    {
        c=contents.c_str()[i];
        //cout<<c;
        if(((c>=65) && (c<=90)) || ((c>=97) && (c<=122)))
        {
            l++;
            if(!gasit)
                nr++;
            gasit=1;
        }
        else gasit=0;
    }
    //cout<<endl;
    //cout<<l<<" "<<nr;
    h<<l/nr;
    g.close();
    h.close();
    return 0;
}