Cod sursa(job #1998303)

Utilizator Eduard663676Ghiuzan Eduard Eduard663676 Data 7 iulie 2017 13:34:12
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <iostream>
#include <stdio.h>
#include <fstream>

using namespace std;

int main() {
	char x;
	int q = 0, l = 0, c = 1;
	ifstream citire("text.in");
	ofstream afisare("text.out");
	while (true) {
		citire.get(x);
		if (x >= 'a' && x <= 'z' || x >= 'A' && x <= 'Z') {
			l++;
			break;
		}
	}
	do {
		citire.get(x);
		q = 0;
		if (x >= 'a' && x <= 'z' || x >= 'A' && x <= 'Z')
			l++;
		else 
			while (q == 0) {
				citire.get(x);
				if (citire.eof())
					break;
				if (x >= 'a' && x <= 'z' || x >= 'A' && x <= 'Z') {
					l++;
					q = 1;
				}
			}
		if (q == 1)
			c++;
	} while (!citire.eof());
	afisare << l / c;
	citire.close();
	afisare.close();
	return 0;
}