该代码的含义 [英] the meaning of this code

查看:104
本文介绍了该代码的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码的含义

the meaning of this code

private void result_Click(object sender, EventArgs e)
       {
           double firstnumber = Convert.ToDouble(txtFirst.Text);
           double secondnumber = Convert.ToDouble(txtSecond.Text);

           if (rdbAddition.Checked == false && rdbSubtraction.Checked == false && rdbMultiplication.Checked == false && rdbDivision.Checked == false)
               MessageBox.Show("Please Select Operation Before Calculator", "Message Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);

           if (rdbAddition.Checked)
           {
               txtAnswer.Text = Convert.ToString(firstnumber + secondnumber);
           }
           else if (rdbSubtraction.Checked)
           {
               txtAnswer.Text = Convert.ToString(firstnumber - secondnumber);
           }
           else if (rdbMultiplication.Checked)
           {
               txtAnswer.Text = Convert.ToString(firstnumber * secondnumber);
           }
           else if (rdbDivision.Checked)
           {
               txtAnswer.Text = Convert.ToString(firstnumber / secondnumber);
           }

推荐答案

这意味着您必须拿起一本有关C#的初学者书籍并进行研究.

所有这些操作都是在文本框中输入两个数字,选中几个复选框以弄清楚它们的作用,然后对这两个数字执行请求的操作,然后将结果存储在另一个文本框中.

确实,这对于一个简单的计算器来说是不好的代码.
It means you have to pick up a beginners book on C# and work through it.

All this does is take two numbers that are entered in textboxes, check a few checkboxes to figure out what to do with them and perform the requested operation on those two numbers, storing the result in another textbox.

Really, this is bad code for a simple calculator.


这看起来像WinForms中的一个简单计算器应用程序.

似乎有两个数字-firstnumbersecondnumber(作为文本存储在两个TextBox控件中);对它们应用适当的算术运算(由一堆RadioButton控件的状态确定),并将结果存储在第三个TextBox中.

就是这样.
This looks like a simple calculator app in WinForms.

It seems to take two numbers - firstnumber and secondnumber (stored as text in two TextBox controls); apply the appropriate arithmetic operation on them (determined by the state of a bunch of RadioButton controls) and store the result in a third TextBox.

That''s pretty much it.


这堆代码的含义是这样的.

有2个TextBox接受数字,以及4个复选框/单选按钮,用于加,减,乘和除.

首先输入一些数字,然后此代码检查是否单击了任何复选框,如果没有,则显示消息"请选择计算器前操作",如果是,则执行加,减,乘或除的功能.

希望您现在就了解此代码块.

谢谢
Tapan kumar
The meaning of this bunch of code is like this.

There are 2 TextBox accepting numbers, and 4 checkbox/radio button for addition, subtraction, multiplication and division.

First you enter some numbers then, this code checks if any of the check box is clicked or not, if no, then show a message "Please Select Operation Before Calculator", and if yes then it does the functionality of addition, subtraction, multiplication, or division accordingly.

Hope you understand this code block now.

Thanks
Tapan kumar


这篇关于该代码的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆