Pagini recente » Cod sursa (job #2108077) | Cod sursa (job #539948) | Cod sursa (job #1729071) | Cod sursa (job #1531891) | 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;
}