Cod sursa(job #711641)
| Utilizator | Data | 12 martie 2012 15:58:57 | |
|---|---|---|---|
| Problema | Text | Scor | 90 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
using namespace std;
int ischar(char c)
{
if(('A'<=c&&'Z'>=c)||('a'<=c&&'z'>=c))
return 1;
return 0;
}
int main()
{
char c1='a', c2='\0';
ifstream f("text.in");
ofstream g("text.out");
long int sum=0, nc=0;
while(!f.eof())
{
c2=f.get();
if(ischar(c2)==1)
sum++;
else
if(ischar(c1)==1)
nc++;
c1=c2;
}
g<<sum/nc;
return 0;
}
