下面是编程之家 jb51.cc 通过网络收集整理的代码片段。
编程之家小编现在分享给大家,也给大家做个参考。
#include"graphics.h"
#include"dos.h"
#include"stdio.h"
#include"math.h"
union REGS i,o;
char *text[]={ "7","8","9","*","4","5","6","/","1","2","3","+","0","00",".","-","M","M+","M-","+/-","MR","MC","x^2","sr","OFF","AC","CE","="};
int k=0,pass,op,prop,newnum=1,bt,memo=1,d=0,sq;
long double num=0,accum,m;
void normalbutton(int,int,char**);
void main()
{
int gd=DETECT,gm,x1,x2,y1,y2,i,j,maxx,maxy,x,y,button;
char *text1[]={""","T","o"," ","K","n","w","a","b","u","t","m","e","l","g",":"};
char *text2[]={"w","c","i","s","k","d","p","h"};
initgraph(&gd,&gm,"");
if(initmouse()==0)
{
closegraph();
restorecrtmode();
printf("
Mouse driver not loded");
exit(1);
}
showmouseptr();
// x=y=50;
movemouseptr(&x,&y);
setbkcolor(11);
setcolor(1);
rectangle(198,140,417,163);
rectangle(199,141,418,164);
rectangle(197,139,416,162);
rectangle(185,130,430,450);
rectangle(184,129,431,451);
rectangle(182,127,433,454);
rectangle(181,126,434,453);
//setfillstyle(SOLID_FILL,3);
//bar(200,142,415,161);
outtextxy(200,50,"A Calculator in C");
outtextxy(200,100,"Press OFF button to exit....");
y1=140;
y2=160;
for(j=0;j<7;j++)
{
x1=200;
x2=235;
y1+=40;
y2