Pagini recente » Monitorul de evaluare | Cod sursa (job #257899) | Cod sursa (job #1552629) | Cod sursa (job #2333313) | Cod sursa (job #865183)
Cod sursa(job #865183)
#include <fstream>
#include <string.h>
#include <cmath>
using namespace std;
void copy(char destinatie[131076],char sursa[131076])
{
strcpy(destinatie,"");
if(sursa==NULL)
return;
else
strcpy(destinatie,sursa);
}
int main()
{
ifstream fin("text.in");
ofstream fout("text.out");
//
char sep[50]="!\"#$%&'()*^+`-=_./:;<=>?@ \n[]{}~|0123456789";
char sir[131076];
char temp[131076];
int cuvinte=0,lungime=0;
while(!fin.eof())
{
fin.getline(sir,131076);
strcat(sir,
copy(temp,strtok(sir,sep));
while(strlen(temp)>0)
{
cuvinte++;
lungime+=strlen(temp);
copy(temp,strtok(NULL,sep));
}
fin.get();
}
if(lungime==0)cuvinte=1;
fout<<floor(lungime/cuvinte)<<endl;
fin.close();
fout.close();
return 0;
}