Cod sursa(job #490206)

Utilizator uvas94savu alexandru uvas94 Data 5 octombrie 2010 15:52:51
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <fstream>
#include<string>
using namespace std;
int main()
{ifstream f("text.in");
ofstream g("text.out");
char c;
int cont1=0,cont2=0,a=0;
while(!f.eof())
    {f>>c;
    if((c>='a' && c<='z') || (c>='A' && c<='Z'))
        {cont1++;
		a++;}
    else
        if(a!=0)
           {cont2++;
			a=0;}
            else
            if(c=='!' || c=='?' || c=='.')
            cont2++;

    }
    a=cont1/cont2;
g<<a;
f.close();
g.close();
    return 0;
}