Pagini recente » Cod sursa (job #2197796) | Cod sursa (job #1210850) | Cod sursa (job #2267109) | Cod sursa (job #1547631) | Cod sursa (job #371272)
Cod sursa(job #371272)
#include<stdio.h>
using namespace std;
char x;
int lit,cuv,ok;
int main()
{
FILE *f=fopen("text.in","r"), *g=fopen("text.out","w");
fscanf(f,"%c",&x);
if( (x>64 && x<91) || (x>96 && x<123) )
{lit=1; cuv=1; ok=1;}
while(x!='\n')
{fscanf(f,"%c",&x);
if( (x>64 && x<91) || (x>96 && x<123) )
{lit++;
if(!ok) {cuv++; ok=1;}
}
else ok=0;
}
fprintf(g,"%d\n",lit/cuv);
fclose(f);
fclose(g);
return 0;
}