📄 calcul.txt
字号:
printf("/");gettext(14,3,16,5,bufdiv0);
/*****以下为0~9的按钮********************/
/*Button "7"*/
window(2,7,4,9);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("7");gettext(2,7,4,9,buf70);
/*Button "8"*/
window(6,7,8,9);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("8");gettext(6,7,8,9,buf80);
/*Button "9"*/
window(10,7,12,9);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("9");gettext(10,7,12,9,buf90);
/**************************************/
/*Button "4"*/
window(2,11,4,13);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("4");gettext(2,11,4,13,buf40);
/*Button "5"*/
window(6,11,8,13);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("5");gettext(6,11,8,13,buf50);
/*Button "6"*/
window(10,11,12,13);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("6");gettext(10,11,12,13,buf60);
/**************************************/
/*Button "1"*/
window(2,15,4,17);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("1");gettext(2,15,4,17,buf10);
/*Button "2"*/
window(6,15,8,17);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("2");gettext(6,15,8,17,buf20);
/*Button "3"*/
window(10,15,12,17);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("3");gettext(10,15,12,17,buf30);
/*Button "0"*/
window(6,19,8,21);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("0");gettext(6,19,8,21,buf00);
/*buton "("*/
window(2,19,4,21);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("(");gettext(2,19,4,21,bufleft0);
/*buton ")"*/
window(10,19,12,21);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf(")");gettext(10,19,12,21,bufright0);
/*Button "="*/
window(14,19,16,21);
textbackground(BLUE);
textcolor(RED);
clrscr();
gotoxy(2,2);
printf("=");gettext(14,19,16,21,bufequ0);
/**********************************************************************************/
/****正常按钮******************************************************************************/
/*********以下为 + - * / 的按钮******************************/
/*Button "+"*/
window(2,3,4,5);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("+");
gettext(2,3,4,5,bufadd);
/*Button "-"*/
window(6,3,8,5);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("-");
gettext(6,3,8,5,bufsub);
/*Button "*"*/
window(10,3,12,5);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("*");gettext(10,3,12,5,bufmul);
/*Button "/"*/
window(14,3,16,5);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("/");gettext(14,3,16,5,bufdiv);
/*****以下为0~9的按钮********************/
/*Button "7"*/
window(2,7,4,9);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("7");gettext(2,7,4,9,buf7);
/*Button "8"*/
window(6,7,8,9);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("8");gettext(6,7,8,9,buf8);
/*Button "9"*/
window(10,7,12,9);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("9");gettext(10,7,12,9,buf9);
/**************************************/
/*Button "4"*/
window(2,11,4,13);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("4");gettext(2,11,4,13,buf4);
/*Button "5"*/
window(6,11,8,13);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("5");gettext(6,11,8,13,buf5);
/*Button "6"*/
window(10,11,12,13);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("6");gettext(10,11,12,13,buf6);
/**************************************/
/*Button "1"*/
window(2,15,4,17);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("1");gettext(2,15,4,17,buf1);
/*Button "2"*/
window(6,15,8,17);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("2");gettext(6,15,8,17,buf2);
/*Button "3"*/
window(10,15,12,17);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("3");gettext(10,15,12,17,buf3);
/*Button "0"*/
window(6,19,8,21);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("0");gettext(6,19,8,21,buf0);
/*buton "("*/
window(2,19,4,21);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("(");gettext(2,19,4,21,bufleft);
/*buton ")"*/
window(10,19,12,21);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf(")");gettext(10,19,12,21,bufright);
/*Button "="*/
window(14,19,16,21);
textbackground(BLACK); /*设置窗口背景色*/
textcolor(WHITE);
clrscr();
gotoxy(2,2);
printf("=");gettext(14,19,16,21,bufequ);
/*****************************************************************************/
/*****************************************************************************/
/*以下显示提示及计算结果*/
window(18,3,72,15);
textbackground(RED); /*设置窗口背景色*/
clrscr();
gotoxy(2,2);
printf(" Press number button or operator button");
window(19,5,71,14);
textbackground(BLUE); /*设置窗口背景色*/
clrscr();
gettext(18,3,72,15,bufshow);
/*****************************************************************************/
/*以上产生各个按钮,并保存按钮*/
/*****************************************************************************/
}
/******************************************************/
void reset()
{
puttext(2,3,4,5,bufadd);
puttext(6,3,8,5,bufsub);
puttext(10,3,12,5,bufmul);
puttext(14,3,16,5,bufdiv);
puttext(2,7,4,9,buf7);
puttext(6,7,8,9,buf8);
puttext(10,7,12,9,buf9);
puttext(2,11,4,13,buf4);
puttext(6,11,8,13,buf5);
puttext(10,11,12,13,buf6);
puttext(2,15,4,17,buf1);
puttext(6,15,8,17,buf2);
puttext(10,15,12,17,buf3);
puttext(6,19,8,21,buf0);
puttext(2,19,4,21,bufleft);
puttext(10,19,12,21,bufright);
puttext(14,19,16,21,bufequ);
}
/*******************************************************/
/*display()子函数*/
void display( key)
long key;
{
switch(key)
{
/*Button "+"*/
case 3371:
puttext(2,3,4,5,bufadd0);
delay(6000);
break;
/*Button "-"*/
case 3117:
puttext(6,3,8,5,bufsub0);
delay(6000);
break;
/*Button "*"*/
case 2346:
puttext(10,3,12,5,bufmul0);
delay(6000);
break;
/*Button "/"*/
case 13615:
puttext(14,3,16,5,bufdiv0);
textbackground(BLUE); /*设置窗口背景色*/
delay(6000);
break;
/*****以下为0~9的按钮********************/
/*Button "7"*/
case 2103:
puttext(2,7,4,9,buf70);
delay(6000);
break;
/*Button "8"*/
case 2360:
puttext(6,7,8,9,buf80);
delay(6000);
break;
/*Button "9"*/
case 2617:
puttext(10,7,12,9,buf90);
delay(6000);
break;
/**************************************/
/*Button "4"*/
case 1332:
puttext(2,11,4,13,buf40);
delay(6000);
break;
/*Button "5"*/
case 1589:
puttext(6,11,8,13,buf50);
delay(6000);
break;
/*Button "6"*/
case 1846:
puttext(10,11,12,13,buf60);
delay(6000);
break;
/**************************************/
/*Button "1"*/
case 561:
puttext(2,15,4,17,buf10);
delay(6000);
break;
/*Button "2"*/
case 818:
puttext(6,15,8,17,buf20);
delay(6000);
break;
/*Button "3"*/
case 1075:
puttext(10,15,12,17,buf30);
delay(6000);
break;
/*Button "0"*/
case 2864:
puttext(6,19,8,21,buf00);
textbackground(BLUE); /*设置窗口背景色*/
delay(6000);
break;
/*buton "("*/
case 2600 :
puttext(2,19,4,21,bufleft0);
delay(6000);
break;
/*buton ")"*/
case 2857:
puttext(10,19,12,21,bufright0);
delay(6000);
break;
/*Button "="*/
case 3389:
puttext(14,19,16,21,bufequ0);
delay(6000);
break;
}/* END of switch(key)*/
}/* End of display()*/
/****************************************************************************/
char keytochar(key)
long key;
{
switch(key)
{
case 2864:
return('0');
case 561:
return('1');
case 818:
return('2');
case 1075:
return('3');
case 1332:
return('4');
case 1589:
return('5');
case 1846:
return('6');
case 2103:
return('7');
case 2360:
return('8');
case 2617:
return('9');
case 2346:
return('*');
case 3117:
return('-');
case 3371:
return('+');
case 13615:
return('/');
case 2600:
return('(');
case 2857:
return(')');
}
}
float chartofloat(ch)
char ch;
{
switch(ch)
{
case '0': return(0.0);
case '1':return(1.0);
case '2':return(2.0);
case '3':return(3.0);
case '4':return(4.0);
case '5':return(5.0);
case '6':return(6.0);
case '7':return(7.0);
case '8':return(8.0);
case '9':return(9.0);
}
}
/********************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -