Nu aveti permisiuni pentru a descarca fisierul grader_test7.ok
Cod sursa(job #34509)
| Utilizator | Data | 20 martie 2007 20:40:52 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.61 kb |
#include<fstream.h>
#include<iomanip.h>
#include<iostream.h>
int main()
{ ifstream f("text.in",ios::in);
ofstream g("text.out");
int k_cuv=0,k_lit=0;
char c,aux='0';
while(!f.eof())
{ f>>resetiosflags(ios::skipws)>>c;
if((((((((((((c!='-'&&c!='!')&&c!='?')&&c!='.')&&c!=',')&&c!=';')&&c!=':')&&c!='[')&&c!=']')&&c!='/')&&c!='^')&&c!='<')&&c!='>')
{ if(c=='\n') k_cuv++;
else if(c==' ') k_cuv++;
else if(aux=='-') {k_cuv++;k_lit++;}
else k_lit++;
}
if(c=='-') aux=c;
else aux='0';
}
if(k_lit==0||k_cuv==0) g<<0;
else g<<k_lit/k_cuv;
f.close();
g.close();
}
