Pagini recente » Cod sursa (job #1724770) | Cod sursa (job #261789) | Cod sursa (job #1856456) | Cod sursa (job #1123882) | Cod sursa (job #884806)
Cod sursa(job #884806)
#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;
}