Cod sursa(job #797204)

Utilizator geannaGeanina Balan geanna Data 13 octombrie 2012 17:04:07
Problema Text Scor 30
Compilator c Status done
Runda Arhiva de probleme Marime 0.42 kb
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
	int c=0,i=0;
	FILE *f,*g;
	char s[50], *p;
	f=fopen("text.in","r");
	g=fopen("text.out","w");
	while ( fgets ( s, sizeof(s), f ) != NULL )
	{
		p=strtok(s," /-?!;',:");
	while(p)
	{
		c++;
		i+=strlen(p);
		p=strtok(NULL," /-?!;',:");
		
	}
	}
	
	/*fprintf(g,"%d\n%d",i,c);
	*/
	fprintf(g,"%d",i/c);
	fclose(f);
	fclose(g);
	return 0;
}