C# 计算器
来源:互联网 发布:台州招聘淘宝美工学徒 编辑:程序博客网 时间:2024/05/24 01:47
自己写的一个超级简单的计算器程序,算是开始入门:
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 WindowsFormsApplication2{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btn_caculate_Click(object sender, EventArgs e) { //1. 获取数据 String num1 = textBox1.Text; String num2 = textBox2.Text; //int result = int.Parse(num1) + int.Parse(num2); //2.类型转换 int a=int.Parse(num1); int b=int.Parse(num2); double result = 0; //3.判断用户选择计算规则 if (rad_add.Checked == true) { result = a + b; } else if (rad_minus.Checked == true) { result = a - b; } else if (rad_mult.Checked == true) { result = a * b; } else if (rad_divid.Checked == true) { result = a / b; } //4.文本框显示 txt_result.Text = result.ToString(); MessageBox.Show(result.ToString()); } }}
0 0
- C# 计算器
- C# 计算器
- c# 计算器
- C# 计算器
- c#计算器
- C#计算器
- C# 计算器
- C#计算器
- C# 计算器
- c# 计算器
- c#调用计算器
- C#小型计算器
- C#简单计算器
- C#计算器代码
- c# 做计算器
- c#实现科学计算器
- 计算器c#实现
- C#实现计算器代码
- spring事务配置几种方式
- ascx文件用法 (网易博客)
- php字符转码
- 我要写新闻,哈哈
- 正则匹配电话、QQ、邮箱
- C# 计算器
- 为什么C++变量名字和函数名字不能是同一个?
- 设置自定义ASP.NET服务器控件TagPrefix的几种方法 (博客园)
- 【HEVC学习与研究】37、HM编码器的基本结构2:帧内编码部分的代码骨架
- Eclipse下安装MinGW编译器。。
- Sublime10个常用插件
- spring 事务管理
- 博客新加入“扫码阅读”功能
- 开通Amazon S3帐户