php中文网 | cnphp.com

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 488|回复: 0

dos 计算器

[复制链接]

2614

主题

2621

帖子

9276

积分

管理员

Rank: 9Rank: 9Rank: 9

UID
1
威望
0
积分
6540
贡献
0
注册时间
2021-4-14
最后登录
2024-4-17
在线时间
665 小时
QQ
发表于 2022-3-31 17:05:11 | 显示全部楼层 |阅读模式
[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]





上一篇:银行项目 c语言
下一篇:html AR代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|php中文网 | cnphp.com ( 赣ICP备2021002321号-2 )51LA统计

GMT+8, 2024-4-19 17:26 , Processed in 0.176941 second(s), 32 queries , Gzip On.

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

申明:本站所有资源皆搜集自网络,相关版权归版权持有人所有,如有侵权,请电邮(fiorkn@foxmail.com)告之,本站会尽快删除。

快速回复 返回顶部 返回列表