Pagini recente » Istoria paginii utilizator/raisacmt | Profil Dazipignil | Diferente pentru schimbare-borland intre reviziile 18 si 25 | Monitorul de evaluare | Cod sursa (job #348506)
Cod sursa(job #348506)
#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+1];
x.getline(p,n);
q=strtok(p,sep);
while(q)
{
nr+=strlen(q);
cv++;
q=strtok(NULL,sep);
}
if(cv!=0)
{
cout<<nr<<' '<<cv<<endl<<nr/cv<<endl;
y<<nr/cv<<endl;
}
y.close();
x.close();
cout<<p;
return 0;
}