Cod sursa(job #711021)
| Utilizator | Data | 11 martie 2012 09:53:56 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<cstdio>
#include<cstring>
using namespace std;
bool isalpha(char a)
{
if(a>='a'&&a<='z'||a>='A'&&a<='Z')
return 1;
return 0;
}
int main()
{
FILE*iFile=fopen("text.in","r"),*oFile=fopen("text.out","w");
char s;int i,s1=0,s2=0;bool k=1;
while(!feof(iFile))
{
fscanf(iFile,"%c",&s);
if(isalpha(s))
s1++;
else
k=1;
if(isalpha(s)&&k)
{
s2++;k=0;
}
}
fprintf(oFile,"%i",s1/s2);
}
