Cod sursa(job #1227980)
Utilizator | Data | 12 septembrie 2014 14:05:39 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char text[1030];
int main()
{
int iNrChar=0, iNrWords=0;
f.getline(text,1030);
for(int i=0; i<strlen(text); i++)
if(isalpha(text[i])) {
++iNrChar;
if(!isalpha(text[i-1]))
++iNrWords;
}
g<<iNrChar/iNrWords;
return 0;
}