Cod sursa(job #93247)

Utilizator ganezuuganea adrian florin ganezuu Data 18 octombrie 2007 10:03:27
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include<stdio.h>
#include<stdlib.h>
#include<string.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");
	
	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;

}