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