Cod sursa(job #1677034)

Utilizator nicholascantarNicholas David Cantar Gogitidze nicholascantar Data 6 aprilie 2016 12:15:49
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.82 kb
#include <fstream>

using namespace std;
char c;
int ok1,nr,nrc;
int main()
{
    ifstream fin ("text.in");
    ofstream fout ("text.out");
    while(c!='\n')
    {
        if (((c>='a'&&c<='z')||(c>='A'&&c<='Z'))&&(c!='.')&&(c!='!')&&(c!='?')&&(c!=';')&&(c!='-')&&(c!=',')) nrc++;
        c=fin.get();
        ok1=1;
        while (((c>='a'&&c<='z')||(c>='A'&&c<='Z'))&&(c!='.')&&(c!='!')&&(c!='?')&&(c!=';')&&(c!='-')&&(c!=','))
        {
            //fout<<c<<'\n';
            ok1=0;
            nrc++;
            c=fin.get();
        }
        if (ok1==0) nr++;
        if (ok1==0)
        while ((c=='.')||(c=='!')||(c=='?')||(c==';')||(c=='-')||(c==','))
        {
            ok1=1;
            c=fin.get();
        }
    }
    //fout<<nrc<<" "<<nr<<'\n';
    fout<<nrc/nr<<'\n';
    return 0;
}