C#--,设计一个windows应用程序,实现不同运算。
2012-11-03 15:31
716 查看
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 WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { } private void Form1_Load(object sender, EventArgs e) { comboBox1.Items.Add("+"); comboBox1.Items.Add("-"); comboBox1.Items.Add("*"); comboBox1.Items.Add("/"); comboBox1.SelectedIndex = 0; } private void button1_Click(object sender, EventArgs e) { if (comboBox1.Text == "+") { double x = double.Parse(textBox1.Text); double y = double.Parse(textBox2.Text); textBox3.Text = (x + y).ToString(); } if (comboBox1.Text == "-") { double x = double.Parse(textBox1.Text); double y = double.Parse(textBox2.Text); textBox3.Text = (x - y).ToString(); } if (comboBox1.Text == "*") { double x = double.Parse(textBox1.Text); double y = double.Parse(textBox2.Text); textBox3.Text = (x * y).ToString(); } if (comboBox1.Text == "/") { double x = double.Parse(textBox1.Text); double y = double.Parse(textBox2.Text); textBox3.Text = (x/y).ToString(); } } } }
相关文章推荐
- 设计一个windows应用程序,实现不同运算。
- C#窗体-个人简历生成(自己设计并编写一个 Windows 应用程序,要求用到TextBox、GroupBox、RadioButton )
- C#Windows 窗体设计-实现欢迎界面-显示About窗体-在托盘中写入应用程序图标
- 利用Timer控件【Timer(6.4.9)】编写C# Windows应用程序,设计一个如下效果电子时钟。
- 今天看到一个C#写的启动windows应用程序的功能,感觉很好
- 转载:C#只允许运行应用程序的一个实例的正确实现方法
- wince应用程序(实现 获取存储设备的大小、实现 WINCE 系统重新启动、隐藏/显示 Windows 任务栏等等)【C#】
- C# 创建、部署和调用WebService的简单示例 webservice 可以用于分布式应用程序之间的交互,和不同程序之间的交互。 概念性的东西就不说太多,下面开始创建一个简单的webservi
- C#如何实现一个简单的流程图设计器
- 用C#设计Windows应用程序模板
- 1. 请用C#的面向对象语言 实现 一个计算器控制台程序,要求输入两个数和运算符号,得到结果
- [讨论]一个关屏程序分别用c#.net cf 和 evc++实现的不同
- C#用DesignSurface实现一个简单的窗体设计器
- C#用DesignSurface实现一个简单的窗体设计器
- (1)定义一个接口Compute含有一个方法int computer(int n,int m); (2)设计四个类分别实现此接口,完成+-*/运算 (3)设计一个类UseCompute,含有方法: public void useCom(Compute com, int one, int two) (4)设计一个测试类
- 使用C# 完美实现多语言版本Windows应用程序
- 设计一个计算器类Claculator,它只有一个用于计数的数据成员count。该计算器的有效计数范围是0~65535,实现计数器的前自增、后自增、前自减、后自减、两个计算器相加减运算
- C#第1次试验(4)设计一个程序,输入10个数存入数组中,然后实现冒泡排序
- C#小练习(设计一个程序,输入10个数存入数组中,然后实现冒泡排序。 )
- C#用DesignSurface实现一个简单的窗体设计器