📄 test.c
字号:
#include<dos.h>
#include<math.h>
#include<graphics.h>
#include<conio.h>
#include<stdio.h>
#include<alloc.h>
#include<stdlib.h>
FILE *fp;
int key;
char *hzcode="人体小测试\n" ;
char *pjch[4]={ "最好\n","次好\n","一般\n","较差\n" };
char *charcd[12]={
"最佳的受孕时间\n" ,
"最佳的工作时间\n" ,
"运动员竞技时间\n" ,
"灵感易产生时间\n" ,
"出成绩考试时间\n" ,
"受教育最佳时间\n" ,
"偶然事故的时间\n" ,
"夫妻易口角时间\n" ,
"驾驶员出事时间\n" ,
"患病和死亡时间\n" ,
"未婚男女般配否\n" ,
"离开人体小测试\n"
} ;
struct TT{int birth[3];int now[3]; }time[2];
struct MM{int p[61];int s[61];int i[61];}man[2];
int howday[2];
int ppjj[61];
void clear1(void)
{
unsigned int g;
register int i,j;
int x,y,c;
setfillstyle(1,2);
setcolor(2);
for(i=39;i>=0;i--)
{
for(x=i,y=39;x<=39;x++,y--)
{bar((x<<4),(y<<3)+(y<<2),(x<<4)+16,(y<<2)+(y<<3)+12);
bar((38-x)*16,y*12,(38-x)+16,y*12+12);
bar((38-x)*16,(39-y)*12,(38-x)*16+16,(39-y)*12+12);
bar(x*16,(39-y)*12,x*16+16,(39-y)*12+12);
}
delay(2);
}
}
void clear2(void)
{
unsigned int g;
register int i,j;
int x,y,c;
setfillstyle(0,2);
setcolor(2);
for(i=39;i>=0;i--)
{
for(x=i,y=39;x<=39;x++,y--)
{bar((x<<4),(y<<3)+(y<<2),(x<<4)+16,(y<<2)+(y<<3)+12);
bar((38-x)*16,y*12,(38-x)+16,y*12+12);
bar((38-x)*16,(39-y)*12,(38-x)*16+16,(39-y)*12+12);
bar(x*16,(39-y)*12,x*16+16,(39-y)*12+12);
}
delay(2);
}
}
word(int *hzcode,int xfd,int yfd,int xjiange,int color,int x,int y)
{
char dot[33],*hzmatrix;
unsigned int ch;
long int order;
int i,j,k,t,p=0;
int x1,y1;
hzmatrix=(char *)malloc(256);
if(!hzmatrix){closegraph();printf("Mem alloc error.");exit(0);}
x1=x;y1=y;
while(hzcode[p]!='\n')
{
k=0;
fseek(fp,0L,SEEK_SET);
order=(long)(((hzcode[p]>>8)&0x7f)-0x21+94*((hzcode[p]&0x7f)-0x21))*32;
fseek(fp,(long)order ,SEEK_SET);
if(!fread(dot,32,1,fp)){closegraph();printf("read hzk16 file error.");exit(0);}
for(i=0;i<16;i++,k+=2)
{
ch=(unsigned int)(((unsigned int)dot[k]<<8)+(unsigned char)dot[k+1]);
for(j=0;j<16;j++,ch=(ch<<1))
{
if(ch&0x8000)hzmatrix[j+16*i]=1;
else hzmatrix[j+16*i]=0;
}
}
for(t=0;t<16;t++)
for(j=0;j<16;j++)
{
if(hzmatrix[j+16*t])
{
for(i=0;i<xfd;i++)
{
putpixel(x1+i+xfd*j,y1+t*yfd,color);
for(k=0;k<yfd;k++)
putpixel(x1+i+xfd*j,y1+k+t*yfd,color);
}
}
}
p++;
x1=x+xfd*(16+xjiange)*p;
}
free(hzmatrix);
};
void initdo(void)
{
int i;
clear2();
setcolor(12);
setfillstyle(1,7);
bar3d(0,10,629,479,10,10);
setfillstyle(1,1);
bar3d(20,20,600,245,8,6);
bar3d(20,265,600,470,8,6);
setfillstyle(0,1);
floodfill(602,300,12);floodfill(100,263,12);
floodfill(100,18,12);floodfill(602,100,12);
/*start draw bar*/
setlinestyle(7,12,0);
setcolor(GREEN);
for(i=0;i<=100;i+=10)
{line(160,132+i,580,132+i);line(160,132-i,580,132-i);}
for(i=0;i<61;i++)
line(160+i*7,32,160+i*7,232);
setcolor(RED+8);
line(160,132,580,132);line(160,32,160,232);line(160,232,580,232);
/*start wirte*/
settextstyle(0,0,0);
outtextxy(150,129,"0");outtextxy(142,109,"20");outtextxy(142,89,"40");
outtextxy(142,69,"60");outtextxy(142,49,"80");outtextxy(134,29,"100");
outtextxy(134,149,"-20");outtextxy(134,169,"-40");outtextxy(134,189,"-60");
outtextxy(134,209,"-80");outtextxy(126,229,"-100");
outtextxy(157,234,"1");outtextxy(185,234,"5");outtextxy(217,234,"10");
outtextxy(252,234,"15");outtextxy(287,234,"20");outtextxy(322,234,"25");
outtextxy(357,234,"30");outtextxy(392,234,"35");outtextxy(427,234,"40");
outtextxy(462,234,"45");outtextxy(497,234,"50");outtextxy(535,234,"55");
outtextxy(567,234,"60");
word("黄
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -