Cod sursa(job #534609)
Utilizator | Oriana oriana | Data | 15 februarie 2011 21:30:10 |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include<fstream>
#include <iomanip.h>
using namespace std;
ifstream f ("text.in");
ofstream g ("text.out");
int i=1,ok,s,c=1;
char v;
int main ()
{while (!f.eof())
{f>> resetiosflags (ios::skipws) >>v;
if ((v>='A'&&v<='Z')||(v>='a'&&v<='z'))
{s=s+1;ok=1;}
else if ((v==' ' || v=='_' || v==',' || v=='(' || v==')' || v=='.' || v=='!' || v=='?' || v=='-' || v==';' || v==':')&&ok)
{c=c+1;ok=0;}}
g<<(s)/c;
}