Pagini recente » Cod sursa (job #440126) | Cod sursa (job #1740470) | Cod sursa (job #1226514) | Cod sursa (job #562737) | Cod sursa (job #2218171)
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
int main()
{ ifstream f("text.in");
ofstream g("text.out");
char s;
long double l=0,nr=0;
bool iuytresxcvbhju =0;
while(f>>noskipws>>s){//in sfarsit f.......
if(isalpha(s)){
l++;
iuytresxcvbhju=1;
}
else if(iuytresxcvbhju){// daca precedentul a fost litera
iuytresxcvbhju=0;
nr++;
}
}
if(iuytresxcvbhju) nr++;
if(nr!=0)g<<l/nr<<endl;
else g<<0;
f.close();
g.close();
}