Cod sursa(job #1034282)
| Utilizator | Data | 17 noiembrie 2013 19:07:41 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
char ch[255],cha[255];
int lc=1,nc=1,i,n,k=0;
while (!f.eof())
{
while (!isalpha(ch[0]))
f>>ch[0];
f.getline(ch,255);
n=strlen(ch);
for (i=0;i<n;i++)
if (isalpha(ch[i]))
lc++;
else if (isspace(ch[i]) || ch[i]=='-')
nc++;
}
g<<lc/nc;
return 0;
}
