Cod sursa(job #346192)
Utilizator | Porcescu Alexandru TFifes | Data | 7 septembrie 2009 07:38:40 |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.53 kb |
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
int main ()
{
ifstream x("text.in");
int nr=0,cv=0;
char c,a[]=" ,!-?@#$%^&*()_+\[]{};.;",*p;
while(!x.eof())
{
x>>c;
p=strchr(a,c);
if(!p)
{
while(!p && !x.eof())
{
nr++;
x>>c;
p=strchr(a,c);
}
cv++;
}
}
ofstream y("text.out");
if(cv!=0)
y<<(nr/cv);
x.close();
y.close();
return 0;
}