Pagini recente » Cod sursa (job #854146) | Cod sursa (job #2592041) | Cod sursa (job #1595933) | Cod sursa (job #1542255) | Cod sursa (job #93196)
Cod sursa(job #93196)
#include<stdio.h>
#include<string.h>
#include<process.h>
void 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);
}