LZ您好,一下是我自己写的用C#软件编译实现的功能,窗口自己加进去,贴下我的以下代码即可实现如上功能,不过需要自己调试一下喽,望LZ学习进步!~
private void addValues()
{
int lhs = int.Parse(lhsOperand.Text);
int rhs = int.Parse(rhsOperand.Text);
int outcome;
outcome = lhs + rhs;
expression.Text = lhsOperand.Text + " + " + rhsOperand.Text;
result.Text = outcome.ToString();
}
private void subtractValues()
{
int lhs = int.Parse(lhsOperand.Text);
int rhs = int.Parse(rhsOperand.Text);
int outcome;
outcome = lhs - rhs;
expression.Text = lhsOperand.Text + " - " + rhsOperand.Text;
result.Text = outcome.ToString();
}
private void multiplyValues()
{
int lhs = int.Parse(lhsOperand.Text);
int rhs = int.Parse(rhsOperand.Text);
int outcome;
outcome = lhs * rhs;
expression.Text = lhsOperand.Text + " * " + rhsOperand.Text;
result.Text = outcome.ToString();
}
private void divideValues()
{
float lhs = float.Parse(lhsOperand.Text);
float rhs = float.Parse(rhsOperand.Text);
float outcome;
outcome = lhs / rhs;
expression.Text = lhsOperand.Text + " / " + rhsOperand.Text;
result.Text = outcome.ToString();
}
private void remainderValues()
{
float lhs = float.Parse(lhsOperand.Text);
float rhs = float.Parse(rhsOperand.Text);
float outcome;
outcome = lhs % rhs;
expression.Text = lhsOperand.Text + " % " + rhsOperand.Text;
result.Text = outcome.ToString();
}
追问我要的是C语言,C,不是C#,谢谢