Cod sursa(job #1316385)
| Utilizator | Data | 13 ianuarie 2015 19:45:42 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.56 kb |
#include <fstream>
using namespace std;
ifstream f("text.in"); ofstream g("text.out");
int e_litera(char a){
if((a>=65 && a<=90) || (a>=97 && a<=122)
return 1;
return 0;
}
int main(){
int nrcuvinte=0,nrlitere=0;
char c,lastChar=0;
while(f>> noskipws >>c){
if(e_litera(c))
nrlitere++;
if(lastChar!=0){
if(!e_litera(c) && e_litera(lastChar))
nrcuvinte++;
}
lastChar=c;
}
g<<(nrlitere/nrcuvinte);
g.close(); f.close();
return 0;
}
