Cod sursa(job #335195)

Utilizator bugyBogdan Vlad bugy Data 28 iulie 2009 23:16:48
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 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=0,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 )  ) )
			{
				cuv++;
				if(!ok) cuvinte++;
					
				ok = 1;   
				
			}
			else 
				ok=0;
			
		}
		
		

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

fclose(f);
fclose(g);

return 0;}