攀枝花锦绣人家:有谁知道每一句的注释呀,告述一下,我才学,不懂呀?

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/27 19:41:16
#include<stdio.h> /* 包含标准输入输出*/
#include<graphics.h> /* 包含图形函数*/
#include<fcntl.h>/* 定义在与open库子程的函数*/
#include<io.h>/* */
#include"myclib.h"/* */
void init(void);/* */
void dis_hz(int x0,int y0,unsigned code);/* */
void dis_scr(int x, int y, unsigned char *pt,int color);/* */
unsigned char *get_dismat(unsigned code);/* */
unsigned char bytes[32];/* */

main()/* */
{
int i,x,y;/* */
unsigned *ccode="20058068方彬";/*要显示的汉字 */
init(); /* */
x=20;
y=100; /*定义x,y的值 */
while(*ccode!=NULL) /* */
{
while(x<60&&(*ccode!=NULL))
{
dis_hz(x,y,*ccode);/* */
x+=20; /* */
ccode+=1;/* */
}
x=20; /* */
y+=20; /* */
}
getch(); /* */
closegraph(); /* */
}
unsigned char *get_dismat(unsigned code)/* */
{
int down=0;/* */
int up=clib.n-1,mid;/* */
int found=0;/* */
while(down<=up&&!found)/* */
{
mid=(up+down)/2;/* */
if(code==clib.lib[mid].incode)
found=1;/* */
else if(code>clib.lib[mid].incode)/* */
down=mid+1;/* */
else
up=mid-1;/* */
}
return(found? clib.lib[mid].mat:NULL);/* */
}

void dis_hz(int x0,int y0,unsigned code )/* */
{int i;/* */
unsigned char far *p,mat[32];/* */
if(p=get_dismat(code))
dis_scr(x0,y0,p,LIGHTRED);/* */
}
void init(void)
{
int driver=DETECT;/* */
int mode=0;/* */
initgraph(&driver,&mode,"");/* */
}
void dis_scr(int x,int y,unsigned char *pt,int color)
{
unsigned char mask[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};/* */
register int i,j,x0,y0,pos;/* */
unsigned char mat[32];/* */
for(i=0;i<32;i++)
mat[i]=*(pt++);/* */
y0=y;/* */
for(i=0;i<16;i++)
{
x0=x;/* */
pos=2*i;/* */
for(j=0;j<16;j++)
{
if((mask[j%8]&mat[pos+j/8])!=NULL)
putpixel(x0,y0,color);/* */
++x0;/* */
}
++y0;/* */
}
}

找一本C语言的书看一下全部都知道了。

找一本C语言的书看一下全部都知道了。

才学就不要看这么多的代码了.
从基础入手.