Cod sursa(job #448495)
| Utilizator | Data | 3 mai 2010 21:13:16 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <fstream>
using namespace std;
char ch;
short k;
int a,b,c;
int main()
{
FILE *f=fopen("text.in","r");
FILE *g=fopen("text.out","w");
while (fscanf(f,"%c",&ch)==1)
{
if (((ch>='A') && (ch<='Z')) || ((ch>='a') && (ch<='z')))
{
k=1;
a++;
}
else if (k == 1)
{
k=0;
b++;
}
}
if (k==1)
b++;
c=a/b;
fprintf(g,"%d",c);
fclose(f);
fclose(g);
return 0;
}
