计算器如何用c#设置位数
答案:1 悬赏:0 手机版
解决时间 2021-01-09 01:59
- 提问者网友:我的未来我做主
- 2021-01-08 13:30
计算器如何用c#设置位数
最佳答案
- 五星知识达人网友:廢物販賣機
- 2021-01-08 13:49
简单的计算器的代码如下:
{
int fristnum = Convert.ToInt32(this.textBox1.Text);
string choose = this.textBox3.Text;
int secondnum = Convert.ToInt32(this.textBox2.Text);
int sum=0;
switch (choose)
{
case "+":
sum = fristnum + secondnum;
this.textBox4.Text = sum.ToString();
break;
case "-":
sum = fristnum - secondnum;
this.textBox4.Text = sum.ToString();
break;
case "*":
sum = fristnum * secondnum;
this.textBox4.Text = sum.ToString();
break;
case "/":
sum = fristnum / secondnum;
this.textBox4.Text = sum.ToString();
break;
default :
this.textBox4.Text = "无法识别的远算符!";
break;
}
}
catch
{
MessageBox.Show("输入有误!");
}
分享
本回答由电脑网络
{
int fristnum = Convert.ToInt32(this.textBox1.Text);
string choose = this.textBox3.Text;
int secondnum = Convert.ToInt32(this.textBox2.Text);
int sum=0;
switch (choose)
{
case "+":
sum = fristnum + secondnum;
this.textBox4.Text = sum.ToString();
break;
case "-":
sum = fristnum - secondnum;
this.textBox4.Text = sum.ToString();
break;
case "*":
sum = fristnum * secondnum;
this.textBox4.Text = sum.ToString();
break;
case "/":
sum = fristnum / secondnum;
this.textBox4.Text = sum.ToString();
break;
default :
this.textBox4.Text = "无法识别的远算符!";
break;
}
}
catch
{
MessageBox.Show("输入有误!");
}
分享
本回答由电脑网络
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯