Cod sursa(job #326464)

Utilizator bugyBogdan Vlad bugy Data 25 iunie 2009 11:28:09
Problema Text Scor 80
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.66 kb
#include<stdio.h>
using namespace std;

int main()
{
		FILE *f=fopen("text.in","r"), *g=fopen("text.out","w");
		
		int cuvinte=0,ok=0,cuv=1,a;
		char c;
		//fscanf(f,"%c", &c);
		//if(    (   ( (int) c < 65 )  ||  (  (int)c > 122 ) ) || ( ( (int) c < 97) || ( (int) c > 122 )  ) )
		
		
		while(fscanf(f,"%c", &c)!=EOF)
		{	//scanf("%c", &c);
			if(    (   ( (int) c < 65 )  ||  (  (int)c > 90 ) ) && ( ( (int) c < 97) || ( (int) c > 122 )  ) )
			{
				if(ok==1)
					cuvinte++;
				ok=0;
			}
			else {ok=1;cuv++;}		
		}

if(cuvinte==0)
		a=0;
	else
	a=cuv/cuvinte;	
		
		fprintf(g,"%d\n",a);
		
	
	

fclose(f);
fclose(g);

return 0;}