Pagini recente » Cod sursa (job #1780762) | Cod sursa (job #709417) | Cod sursa (job #1780476) | Cod sursa (job #1367771) | Cod sursa (job #1780200)
#include <stdio.h>
#include <ctype.h>
#define BUF_SIZE 131072
FILE *fin,*fout;
char buf[BUF_SIZE];
int pos=BUF_SIZE,lung,co;
inline char getch()
{
if(pos==BUF_SIZE)
fread(buf,BUF_SIZE,1,fin),pos=0;
return buf[pos++];
}
int main()
{
fin=fopen("text.in","r");
fout=fopen("text.out","w");
char ch=getch();
while(!iscntrl(ch))
{
while(!isalpha(ch) && !iscntrl(ch))
ch=getch();
if(isalpha(ch))
{
co++;
do
{
lung++;
ch=getch();
} while(isalpha(ch));
}
}
fprintf(fout,"%d",lung/co);
fclose(fin);
fclose(fout);
return 0;
}