声音只能在空气中传播:谁帮我改改程序啊!让他运行起来象个计算器

来源:百度文库 编辑:神马品牌网 时间:2024/05/06 16:55:06
#include "stdio.h"
#include "conio.h"

void f1()
{
int a=0,b=0,result;
char op;
clrscr();
printf("\n");
printf("1 2 3 +\n");
printf("4 5 6 -\n");
printf("7 8 9 *\n");
printf("0 = /\n");
while(1)
{
op=bioskey(0);
switch(op)

{
case 'r':
return ;
case 'c':
gotoxy(10,20);puts(" ");
break;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case '0':
a=a*10+op-'0';
gotoxy(20,10);printf("%d",a);
gotoxy(30,30);printf(" ");
break;
case'+':
gotoxy(20,10);puts(" ");
result=a+b;
printf("%d",a+b);
b=a;
a=0;
break;

case'-':
gotoxy(20,10);puts(" ");
result=a-b;
printf("%d",a-b);
b=a;
a=0;
break;
case'*':
result=a*b;
break;
case'/':
if(b==0)
printf("error!\n");
result=a/b;
printf("%d",result);
break;
default:
gotoxy(30,30);printf("error due !");
break;
}
}

}
main()
{
int x0,y0;
char a;
while(1)
{
textbackground(1);
textcolor(14);
clrscr();
a=0;
x0=30;
y0=3;

gotoxy(x0+1,y0);
puts(" Main Menu ");
gotoxy(x0,y0+=3);puts("1: Calculator Int");
gotoxy(x0,y0+=2);puts("2: Calculator Float");
gotoxy(x0,y0+=2);puts("0: q u i t");
gotoxy(x0-10,y0+=3);puts("Please select: ");

a=bioskey(0);
switch(a)
{
case '1':
f1();
break;
case '2':
break;
case '0':
exit(0);
default:
textcolor(4);
printf(" error select again" );
bioskey(0);
}
}
}


这个哪个程序啊?我只会Qbasic。C+和C++只会一点。