Pagini recente » Cod sursa (job #1921169) | Cod sursa (job #801899) | Cod sursa (job #1141893) | Cod sursa (job #2579787) | Cod sursa (job #1535426)
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
char text[1000];
ifstream f("text.in");
ofstream g("text.out");
int main()
{
char simb[] = ",.?!-;:+=@#$%^&*()_[]{}/|><`~";
int i=0,nr=0,nr_cuv=0;
while(!f.eof())
{
f.get(text[i]);
if (strchr(simb,text[i])) {i++; continue;}
else if (text[i] != ' '){
int nr_lit = 0; nr_cuv++;
while(!strchr(simb,text[i]) && text[i] != ' ')
{
nr_lit++;
i++;
f.get(text[i]);
}
nr+=nr_lit;
i++;
}
}
g<<(int)(nr/nr_cuv)<<'\n';
f.close();
g.close();
}