用C#语言怎样编写计算其程序?

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/24 01:13:11
用C#语言怎样编写计算其程序?
x[OAǿ(.w(bԘ@bG2vfKA I!*Hh4&&e7n[]FJ/̙9Lae~JK1uwty+_;Osym(֊P}?s< Y:*\>-9گ]XwWïIU`.oGwu=~n'G?閁,|h('"RUE)1[ ˡF "U"& p-Cv1yB fH& 7TO>idhPF}S*uC*4 Pʖ`' SP3)BY"J'Кt&8J&odXFYa1h n&d?Bgm$Ax2QVibpu:]ʭWA 4IM~

用C#语言怎样编写计算其程序?
用C#语言怎样编写计算其程序?

用C#语言怎样编写计算其程序?
这是我做的一个简单计算器,代码如下:
看不懂就给我个地址,我直接把源文件发给你
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 计算器
{
public partial class Form1 :Form
{
char fh;
double number,temp;
private void Form1_Load(object sender,EventArgs e)
{
}
public Form1()
{
InitializeComponent();
}
private void but1_Click(object sender,EventArgs e)
{
textBox1.Text = textBox1.Text + "1";
}
private void but2_Click(object sender,EventArgs e)
{
textBox1.Text = textBox1.Text + "2";
}
private void but3_Click(object sender,EventArgs e)
{
textBox1.Text = textBox1.Text + "3";
}
private void but4_Click(object sender,EventArgs e)
{
textBox1.Text = textBox1.Text + "4";
}
private void but5_Click(object sender,EventArgs e)
{
textBox1.Text = textBox1.Text + "5";
}
private void but6_Click(object sender,EventArgs e)
{
textBox1.Text = textBox1.Text + "6";
}
private void but7_Click(object sender,EventArgs e)
{
textBox1.Text = textBox1.Text + "7";
}
private void but8_Click(object sender,EventArgs e)
{
textBox1.Text = textBox1.Text + "8";
}
private void but9_Click(object sender,EventArgs e)
{
textBox1.Text = textBox1.Text + "9";
}
private void but0_Click(object sender,EventArgs e)
{
textBox1.Text = textBox1.Text + "0";
}
private void but10_Click_1(object sender,EventArgs e)
{
textBox1.Text = textBox1.Text + ".";
}
private void butAdd_Click(object sender,EventArgs e)
{
number = double.Parse(textBox1.Text);
fh = '+';
textBox1.Text = null;
}
private void butMin_Click(object sender,EventArgs e)
{
number = double.Parse(textBox1.Text);
fh = '-';
textBox1.Text = null;
}
private void butMul_Click(object sender,EventArgs e)
{
number = double.Parse(textBox1.Text);
fh = '*';
textBox1.Text = null;
}
private void butDiv_Click(object sender,EventArgs e)
{
number = double.Parse(textBox1.Text);
fh = '/';
textBox1.Text = null;
}
private void buttonDaoShu_Click(object sender,EventArgs e)
{
number = double.Parse(textBox1.Text);
number = 1.0 / number;
textBox1.Text = number.ToString();
fh = ' ';
number = 0;
temp = 0;
}
private void butRev_Click(object sender,EventArgs e)
{
fh = ' ';
number = 0;
temp = 0;
textBox1.Text = null;
}
private void butApp_Click(object sender,EventArgs e)
{
temp = double.Parse(textBox1.Text);
switch (fh)
{
case '+':
number += temp;
break;
case '-':
number -= temp;
break;
case '*':
number *= temp;
break;
case '/':
number /= temp;
break;
}
textBox1.Text = number.ToString();
fh = ' ';
number = 0;
temp = 0;
}
}
}