Cod sursa(job #1227990)
Utilizator | Data | 12 septembrie 2014 14:17:04 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char text, dinainte;
int main()
{
int iNrChar=0, iNrWords=0;
dinainte = '#';
while(f.get(text)) {
if(isalpha(text)) {
++iNrChar;
if(!isalpha(dinainte))
++iNrWords;
}
dinainte = text;
}
g<<iNrChar/iNrWords;
return 0;
}