#include <graphics.h>
#include <conio.h>
main()
{ void drawkey(int,int); /*画键声明*/
/*图形初始化*/
int driver,mode,x,y,x1,y1;
driver=VGA;
mode=VGAHI;
registerbgidriver(EGAVGA_driver);
initgraph(&driver,&mode,"c:\\turboc2");
/*方框填充画计算器外体*/
x=(getmaxx()/2)-150;
y=(getmaxy()/2)-120;
x1=(getmaxx()/2)+150;
y1=(getmaxy()/2)+120;
setfillstyle(SOLID_FILL,7);
bar(x,y,x1,y1);
/*画标题栏*/
setfillstyle(SOLID_FILL,1);
bar(x,y,x1,y+15);
outtextxy(x+12,y+5,"SB COUNTER");
setfillstyle(SOLID_FILL,4);
bar(x1-15,y,x1,y+15);
setcolor(0);
line(x1-15,y,x1,y+15);
line(x1,y,x1-15,y+15);
/*画输出窗口*/
setfillstyle(SOLID_FILL,15);
bar(175,142,425+40,142+20);
/*画键*/
settextstyle(2,0,6);
drawkey(175,200);
outtextxy(175+17,200+5,"7");
drawkey(175,240);
outtextxy(175+17,240+5,"4");
drawkey(175,280);
outtextxy(175+17,280+5,"1");
drawkey(175,320);
outtextxy(175+17,320+5,"0");
drawkey(225,200);
outtextxy(225+17,200+5,"8");
drawkey(225,240);
outtextxy(225+17,240+5,"5");
drawkey(225,280);
outtextxy(225+17,280+5,"2");
drawkey(225,320);
outtextxy(225+17,320+5,".");
drawkey(275,200);
outtextxy(275+17,200+5,"9");
drawkey(275,240);
outtextxy(275+17,240+5,"6");
drawkey(275,280);
outtextxy(275+17,280+5,"3");
drawkey(275,320);
outtextxy(275+17,320+5,"=");
drawkey(325,200);
outtextxy(325+17,200+5,"+");
drawkey(325,240);
outtextxy(325+17,240+5,"-");
drawkey(325,280);
outtextxy(325+17,280+5,"*");
drawkey(325,320);
outtextxy(325+17,320+5,"/");
drawkey(375,200);
outtextxy(375+7,200+5,"+/-");
drawkey(375,240);
outtextxy(375+9,240+5,"sin");
drawkey(375,280);
outtextxy(375+13,280+5,"ln");
drawkey(375,320);
outtextxy(375+3,320+5,"sqrt");
drawkey(425,200);
outtextxy(425+17,200+5,"C");
drawkey(425,240);
outtextxy(425+9,240+5,"cos");
drawkey(425,280);
outtextxy(425+14,280+5,"lg");
drawkey(425,320);
outtextxy(425+7,320+5,"pow");
bar(175,190-20,275+40,190);
outtextxy(175+20,190-20,"space-key");
bar(325,190-20,425+40,190);
outtextxy(325+30,190-20,"backspace");
}
void drawkey(int x,int y) /*画键函数*/
{ int x1,y1;
x1=x+40;
y1=y+30;
setfillstyle(SOLID_FILL,12);
bar(x,y,x1,y1);
}
#include <conio.h>
main()
{ void drawkey(int,int); /*画键声明*/
/*图形初始化*/
int driver,mode,x,y,x1,y1;
driver=VGA;
mode=VGAHI;
registerbgidriver(EGAVGA_driver);
initgraph(&driver,&mode,"c:\\turboc2");
/*方框填充画计算器外体*/
x=(getmaxx()/2)-150;
y=(getmaxy()/2)-120;
x1=(getmaxx()/2)+150;
y1=(getmaxy()/2)+120;
setfillstyle(SOLID_FILL,7);
bar(x,y,x1,y1);
/*画标题栏*/
setfillstyle(SOLID_FILL,1);
bar(x,y,x1,y+15);
outtextxy(x+12,y+5,"SB COUNTER");
setfillstyle(SOLID_FILL,4);
bar(x1-15,y,x1,y+15);
setcolor(0);
line(x1-15,y,x1,y+15);
line(x1,y,x1-15,y+15);
/*画输出窗口*/
setfillstyle(SOLID_FILL,15);
bar(175,142,425+40,142+20);
/*画键*/
settextstyle(2,0,6);
drawkey(175,200);
outtextxy(175+17,200+5,"7");
drawkey(175,240);
outtextxy(175+17,240+5,"4");
drawkey(175,280);
outtextxy(175+17,280+5,"1");
drawkey(175,320);
outtextxy(175+17,320+5,"0");
drawkey(225,200);
outtextxy(225+17,200+5,"8");
drawkey(225,240);
outtextxy(225+17,240+5,"5");
drawkey(225,280);
outtextxy(225+17,280+5,"2");
drawkey(225,320);
outtextxy(225+17,320+5,".");
drawkey(275,200);
outtextxy(275+17,200+5,"9");
drawkey(275,240);
outtextxy(275+17,240+5,"6");
drawkey(275,280);
outtextxy(275+17,280+5,"3");
drawkey(275,320);
outtextxy(275+17,320+5,"=");
drawkey(325,200);
outtextxy(325+17,200+5,"+");
drawkey(325,240);
outtextxy(325+17,240+5,"-");
drawkey(325,280);
outtextxy(325+17,280+5,"*");
drawkey(325,320);
outtextxy(325+17,320+5,"/");
drawkey(375,200);
outtextxy(375+7,200+5,"+/-");
drawkey(375,240);
outtextxy(375+9,240+5,"sin");
drawkey(375,280);
outtextxy(375+13,280+5,"ln");
drawkey(375,320);
outtextxy(375+3,320+5,"sqrt");
drawkey(425,200);
outtextxy(425+17,200+5,"C");
drawkey(425,240);
outtextxy(425+9,240+5,"cos");
drawkey(425,280);
outtextxy(425+14,280+5,"lg");
drawkey(425,320);
outtextxy(425+7,320+5,"pow");
bar(175,190-20,275+40,190);
outtextxy(175+20,190-20,"space-key");
bar(325,190-20,425+40,190);
outtextxy(325+30,190-20,"backspace");
}
void drawkey(int x,int y) /*画键函数*/
{ int x1,y1;
x1=x+40;
y1=y+30;
setfillstyle(SOLID_FILL,12);
bar(x,y,x1,y1);
}