Cod sursa(job #93197)

Utilizator ganezuuganea adrian florin ganezuu Data 18 octombrie 2007 00:00:58
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#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);
	

}