Cod sursa(job #761185)

Utilizator andi_JunkersandiJunkers andi_Junkers Data 25 iunie 2012 03:28:32
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <fstream>
using namespace std;

char c[1024*1024];
unsigned cuv, lcuv;
bool ok=true;
fstream f;

int main()
{
	f.open("text.in", ios::in);
	f.getline(c, 1024*1024);
	f.close();
	f.clear();
	
	for(int i=0; i<strlen(c); i++)
	{
		if(c[i]>='A' && c[i]<='z')
		{
			lcuv++;
			if(ok)
				cuv++;
			ok=false;
		}
		else
			ok=true;
	}
	
	f.open("text.out", ios::out);
	f << lcuv/cuv << endl;
	f.close();
}