Cod sursa(job #536789)

Utilizator maritimCristian Lambru maritim Data 19 februarie 2011 13:37:29
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include<stdio.h>
#include<ctype.h>
using namespace std;

int nr = 0;
int nrc = 0;

void citire(void)
{
	int c;
	int aux;
	FILE *f = fopen("text.in","r");
	aux = '\n';
	
	while(!feof(f))
	{
		if(isalpha(c = fgetc(f)))
		{
		  nr ++;
		}
		else if(isalpha(aux))
		  nrc ++;
		aux = c;
	}
	
	fclose(f);
}

int main()
{
	FILE *g = fopen("text.out","w");
	
	citire();
	fprintf(g,"%d",nr/nrc);
	
	fclose(g);
	return 0;
}