Pagini recente » Cod sursa (job #1659518) | Cod sursa (job #1050828) | Cod sursa (job #2940564) | Cod sursa (job #2870664) | Cod sursa (job #434587)
Cod sursa(job #434587)
#include <iostream>
#include<string>
#include<fstream>
using namespace std;
int main()
{
ifstream f("text.in");
ofstream g("text.out");
char txt[1000],txt2[1000],*p;
long nr=0,k=0;
f.getline(txt,1000);
strcpy(txt2,txt);
p=strtok(txt," .,;");
while(p!=NULL)
{
k++;
p=strtok(NULL," .,;");
}
p=strtok(txt2," .,;-!?_'=)(~/\*@#$%^&");
while(p!=NULL)
{
nr+=strlen(p);
p=strtok(NULL, " .,;-!?_'=)(~/\*@#$%^&");
}
g<<nr/k;
f.close();
g.close();
}