Cod sursa(job #1219987)

Utilizator tudormarcuMarcu Tudor tudormarcu Data 16 august 2014 10:50:45
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <ctype.h>
using namespace std;
int main()
{
	ifstream f ( "text.in" );
	char c = '\0', lc = '\0';
	unsigned int nrC = 0, nrL = 0;

	while ( !f.eof() )
	{
		f >> noskipws >> c;

		if ( !isalpha ( c ) )
		{
			if ( isalpha ( lc ) )
			{
				nrC++;
			}
		}
		else
		{
			nrL++;
		}

		lc = c;
	}

	f.close();
	ofstream g ( "text.out" );
	g << nrL / nrC;
	g.close();
	return 0;
}