Pagini recente » Cod sursa (job #2202276) | Cod sursa (job #2604192) | Cod sursa (job #1264819) | Cod sursa (job #1844795) | Cod sursa (job #348509)
Cod sursa(job #348509)
#include<iostream>
#include<string.h>
#include<fstream>
using namespace std;
int main ()
{
ifstream x("d:\\gt.txt",ios::ate);
ofstream y("d:\\gtout.txt");
unsigned short n,nr=0,cv=0;
n=x.tellg();
x.seekg(0,ios::beg);
char *p,*q,sep[]=" .,/!?@#$%^^&&&**()-_1234567890$%^&(){}"";",c;
p=new (nothrow) char [n+2];
x.getline(p,n+1);
x.close();
q=strtok(p,sep);
while(q)
{
nr+=strlen(q);
cv++;
q=strtok(NULL,sep);
}
if(cv!=0)
{
y<<nr/cv;
}
y.close();
return 0;
}