威望0
积分7946
贡献0
在线时间763 小时
UID1
注册时间2021-4-14
最后登录2024-11-21
管理员
- UID
- 1
- 威望
- 0
- 积分
- 7946
- 贡献
- 0
- 注册时间
- 2021-4-14
- 最后登录
- 2024-11-21
- 在线时间
- 763 小时
|
[mw_shl_code=c,true]#include<stdio.h>
#define p printf
#define s scanf
#define g gotoxy
float num,ans;
char opp;
int y,z,d,a[3];
void designed(int x,int as,int x1),des();
main()
{
a:
ans=0;
des();
g(38,5);s("%f",&ans);
while(opp!='r')
{
b:
des();
if(ans>1000000)
{
g(2,10);p(" The system could not");
g(2,11);p(" proceed because the");
g(2,12);p(" Answer was already");
g(2,13);p(" greater than to");
g(2,14);p(" 1000000.");
g(2,15);p(" Press any key !");
getch();
exit(0);
}
c:
g(38,4);s("%s",&opp);
if(opp=='=')
{
goto b;
}
else if(opp=='r')
{
opp=''; goto a;
}
des();
num=0;
g(38,5);s("%f",&num);
if(opp=='+')
{
ans=ans+num;
}
else if(opp=='-')
{
ans=ans-num;
}
else if(opp=='x')
{
ans=ans*num;
}
else if(opp=='/')
{
ans=ans/num;
}
else
{
des();
g(2,10);p(" The system could not");
g(2,11);p(" compute because you ");
g(2,12);p(" entered a wrong ");
g(2,13);p(" operator.");
goto c;
}
}
getche();
}
void des()
{
clrscr();
a[0]=2;
a[1]=9;
a[2]=16;
designed(1,25,25);
a[1]=6;
designed(37,19,55);
z=14;
g(39,z);
for(y=0;y<=9;y++)
{
p(" %i ",y);
if(d==0)
{
delay(1000000);
}
if(y==0 || y==3 || y==6)
{
z=z-2;
g(39,z);
}
}
g(44,14);p(". =");
g(52,8);p("/");
g(52,10);p("x");
g(52,12);p("-");
g(52,14);p("+");
g(9,1);p("Operator");
g(41,1);p("Calculator");
g(3,3);p("Addition = +");
g(3,4);p("Subtraction = -");
g(3,5);p("Division = /");
g(3,6);p("Multiplication = x");
g(3,7);p("Equals = =");
g(3,8);p("Reset = r");
g(28,3);p("Answer");
g(27,4);p("Operator");
g(28,5);p("Number");
d=1;
g(38,3);p("%f",ans);
g(38,4);p("%c",opp);
}
void designed(int x,int as,int x1)
{
for(y=2;y<=16;y++)
{
if(y==a[0] || y==a[1] || y==a[2])
{
g(x,y);
for(z=0;z<as;z++)
{
p("*");
if(d==0)
{
delay(1000000);
}
}
}
else
{
g(x,y); p("*");
if(d==0)
{
delay(1000000);
}
g(x1,y); p("*");
}
}
}[/mw_shl_code] |
|