Pagini recente » Cod sursa (job #1218465) | Cod sursa (job #1641357) | Cod sursa (job #2373773) | Cod sursa (job #2537266) | Cod sursa (job #915861)
Cod sursa(job #915861)
#include <iostream>
#include<fstream>
#include<string.h>
using namespace std;
int main()
{
ifstream f;
ofstream g;
f.open("text.in");
g.open("text.out");
char s[256], *p, e[]=" ,.!?;:(){}[]/\-""!\@#$%^&*_+<>|'`~";
int i,n=0,c=0;
float k;
f.get(s,256);
i=0;
while(isalpha(s[i])==0)
i++;
strcpy(s,s+i);
p=strtok(s,e);
while(p)
{
c++;
n+=strlen(p);
p=strtok(NULL, e);
}
k=(float)n/(float)c;
if(strlen(s)==0)
g<<"0";
else
g<<(int)k;
return 0;
}