Cod sursa(job #884806)

Utilizator TamasanPaulTamasan Paul Alexandru TamasanPaul Data 21 februarie 2013 12:44:52
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int main() {
    ifstream f("text.in");
    ofstream g("text.out");
    char prop[1000];
    f.get(prop,100);
    int nrCuvinte=0, nrLitere=0, L=strlen(prop), i, totalLitere=0;
	for (i=0; i<=L; i++) {
		if((prop[i]>='a' && prop[i]<='z') || (prop[i]>='A' && prop[i]<='Z')) {
			nrLitere++;
		}
		else {
				if(nrLitere!=0) {
					nrCuvinte++;
					totalLitere=nrLitere+totalLitere;
					nrLitere=0;
			}
		}
	}
	float ma=totalLitere/nrCuvinte;
	g<<ma;
	g.close();
	f.close();
    return 0;
}