Pagini recente » Cod sursa (job #1163913) | Cod sursa (job #2117428) | Cod sursa (job #1376320) | Cod sursa (job #3206907) | Cod sursa (job #150502)
Cod sursa(job #150502)
#include<stdio.h>
char x,aux='\\',w,q;
int cuvinte=0,litere=0,sol,k;
int main ()
{
FILE *f=fopen("text.in","r");
FILE *g=fopen("text.out","w");
while(fscanf(f,"%c",&x)!=EOF)
{
if (x=='\ '||x=='\-'||x=='\,'||x=='\.')
{if (w==aux) cuvinte ++;}
else if ((int)x>=65&&(int)x<=90||(int)x>=97&&(int)x<=122||(int)x>=85&&(int)x<=94)
{litere++;
w=x;}
aux=x;
}
cuvinte++;
sol=litere/cuvinte;
fprintf(g,"%d",sol);
fclose(f);
fclose(g);
return 0;
}