Cod sursa(job #1979493)
| Utilizator | Data | 10 mai 2017 18:25:25 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <fstream.h>
using namespace std;
int main(){
char c_act, c_urm;
int lung_tot = 0, nr_cuv = 0;
ifstream citire ("text.in");
citire.get(c_act);
while (!citire.eof()){
citire.get(c_urm);
if (c_act >= 'a' && c_act <= 'z' || c_act >= 'A' && c_act <= 'Z'){
lung_tot++;
if ((c_urm < 'a' || c_urm > 'z') && (c_urm < 'A' || c_urm > 'Z'))
nr_cuv++;
}
c_act = c_urm;
}
citire.close();
ofstream afisare ("text.out");
afisare << lung_tot / nr_cuv;
afisare.close();
return 0;
}
