Pagini recente » Cod sursa (job #658256) | Cod sursa (job #1392219) | Cod sursa (job #1720001) | Istoria paginii runda/tema_1/clasament | Cod sursa (job #93245)
Cod sursa(job #93245)
#include<stdio.h>
#include<stdlib.h>
int main()
{
int i=1,len=0;
char *p,buff[255],sep[]="-,.:';/!@#$%^&*() \n";
FILE *fp=fopen("text.in.txt","rt"),*f=fopen("text.out.txt","wt");
if(fp==NULL)
{
printf("eroare deschidere fisier\n");
exit(1);
}
fgets(buff,255,fp);
p=strtok(buff,sep);
len+=strlen(p);
while(p)
{
p=strtok(NULL,sep);
if(p)
{
len+=strlen(p);
i++;
}
}
fprintf(f,"%d",len/i);
return 0;
}