Cod sursa(job #709355)
| Utilizator | Data | 8 martie 2012 00:03:17 | |
|---|---|---|---|
| Problema | Text | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.53 kb |
#include <iostream>
#include <string>
#include <fstream>
#include <math.h>
using namespace std;
int main(){
ifstream fin("text.in");
ofstream fout("text.out");
char s;
int charszam=0,szoszam=0;
bool ok=false;
while (!fin.eof()){
fin>>s;
if(((s>='a')&&(s<='z'))||((s>='A')&&(s<='Z'))){
charszam++;
ok=true;
}else if(ok){
szoszam++;
ok=false;
}
}
if (ok){
szoszam++;
}
double x;
if(!szoszam==0){
x=charszam/szoszam;
}else{
x=0;
}
fout<<floor (x);
fout.close();
}
