Cod sursa(job #865960)
Utilizator | Data | 27 ianuarie 2013 13:00:04 | |
---|---|---|---|
Problema | Text | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char c;
int word=0,i,ch=0,prev=0;
int main()
{
while(!f.eof())
{f>>c;
if ((c>=65 && c<=90)||((c>=97)&&(c<=122))) {ch++;prev=1;}
else if (prev) {word++;prev=0;}
}
if (prev) word++;
g<<ch/word;
return 0;
}