资源简介
仿windows自带的计算器,用 VisualStudio2010 开发(含源码)。代码详尽,有注释。很适合学习练习时作参考。

代码片段和文件信息
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 calc : Form
{
public calc()
{
InitializeComponent();
}
double tempNum;//临时存储数据
double result;//存放每次计算的结果
string symbol=““;//存放符号
bool flag = false;// 用于标记符号是否被点击过
public void Jisuan()//进行计算
{
switch (symbol)
{
case “+“:
result = tempNum + Convert.ToDouble(txtShow.Text);
result = Math.Round(result 14);
txtShow.Text = result.ToString();
tempNum = result;
symbol = ““;
break;
case “-“:
result = tempNum - Convert.ToDouble(txtShow.Text);
result = Math.Round(result 14);
txtShow.Text = result.ToString();
tempNum = result;
symbol = ““;
break;
case “*“:
result =tempNum * Convert.ToDouble(txtShow.Text) ;
result = Math.Round(result 14);
txtShow.Text = result.ToString();
tempNum = result;
symbol = ““;
break;
case “/“:
if (Convert.ToDouble(txtShow.Text) == 0)
{
txtShow.Text = “NULL“;
}
else
{
result = tempNum / Convert.ToDouble(txtShow.Text);
result = Math.Round(result 14);
txtShow.Text = result.ToString();
tempNum = result;
symbol = ““;
}
break;
case “%“:
result =tempNum % Convert.ToDouble(txtShow.Text) ;
result = Math.Round(result 14);
txtShow.Text = result.ToString();
tempNum = result;
symbol = ““;
break;
case “sqrt“:
result = Math.Sqrt(tempNum);
result = Math.Round(result 14);
txtShow.Text = result.ToString();
tempNum = result;
symbol = ““;
break;
case “1/x“:
result = 1/tempNum;
result = Math.Round(result 14);
txtShow.Text = result.ToString();
tempNum = result;
symbol = ““;
break;
}
}
public void ClickNum
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-12-14 19:12 计算器\
文件 873 2013-12-14 19:04 计算器\calc.sln
目录 0 2013-12-14 19:03 计算器\计算器\
文件 33507 2013-12-13 11:12 计算器\计算器\Form1.Designer.cs
文件 8639 2013-12-13 12:02 计算器\计算器\Form1.cs
文件 20865 2013-12-13 11:12 计算器\计算器\Form1.resx
文件 489 2013-12-09 16:19 计算器\计算器\Program.cs
目录 0 2013-12-14 09:35 计算器\计算器\Properties\
文件 1376 2013-12-09 15:59 计算器\计算器\Properties\AssemblyInfo.cs
文件 2866 2013-12-09 15:59 计算器\计算器\Properties\Resources.Designer.cs
文件 5612 2013-12-09 15:59 计算器\计算器\Properties\Resources.resx
文件 1092 2013-12-09 15:59 计算器\计算器\Properties\Settings.Designer.cs
文件 249 2013-12-09 15:59 计算器\计算器\Properties\Settings.settings
目录 0 2013-12-14 09:35 计算器\计算器\bin\
目录 0 2013-12-14 19:12 计算器\计算器\bin\Debug\
文件 29184 2013-12-14 19:04 计算器\计算器\bin\Debug\计算器.exe
文件 42496 2013-12-14 19:04 计算器\计算器\bin\Debug\计算器.pdb
文件 11600 2013-12-14 19:12 计算器\计算器\bin\Debug\计算器.vshost.exe
文件 490 2010-03-17 22:39 计算器\计算器\bin\Debug\计算器.vshost.exe.manifest
文件 3677 2013-12-14 19:04 计算器\计算器\my计算器.csproj
目录 0 2013-12-14 09:35 计算器\计算器\obj\
目录 0 2013-12-14 09:35 计算器\计算器\obj\x86\
目录 0 2013-12-14 19:04 计算器\计算器\obj\x86\Debug\
文件 5185 2013-12-10 07:17 计算器\计算器\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6284 2013-12-14 19:12 计算器\计算器\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 1676 2013-12-14 19:04 计算器\计算器\obj\x86\Debug\GenerateResource.read.1.tlog
文件 2988 2013-12-14 19:04 计算器\计算器\obj\x86\Debug\GenerateResource.write.1.tlog
文件 8031 2013-12-10 07:17 计算器\计算器\obj\x86\Debug\ResolveAssemblyReference.cache
目录 0 2013-12-14 19:13 计算器\计算器\obj\x86\Debug\TempPE\
文件 1461 2013-12-14 19:12 计算器\计算器\obj\x86\Debug\my计算器.csproj.FileListAbsolute.txt
文件 180 2013-12-14 19:04 计算器\计算器\obj\x86\Debug\计算器.Properties.Resources.resources
............此处省略5个文件信息
- 上一篇:c#写入多个txt文本
- 下一篇:c# 学生选课系统
相关资源
- C#串口通信程序(VS2010)(serialPort组
- lua C# .Net4.0 vs2010 LuaInterface
- 酒店管理系统C#基于vs2010源代码和SQ
- C#停车场管理系统的设计与实现VS201
- C# VS2010 甘特图
- AO+C# 二次开发版本基本功能源代码使
- 基于C#的人事工资管理系统
- C# 计算器 源代码 C#计算器源代码
- vs2010下C# WinForm 搭建三层架构+NHibern
- 网上订餐系统源码(C#+asp.net+vs2010+s
- Kinect开发变脸游戏
- vS2010 ASP.NET C# WEB开发源代码
- 基于VS2010+C#+SQL Server 2008 开发的网上银
- 基于VS2010+C#+SQL Server 2008 开发的个人财
- asp.net在线相册115584
- Asp.net购物网站大作业vs2010+数据库
- easyui-完整实列 C# VS2010
- C#停车场管理系统的设计与实现VS201
- C#基于vs2010的ArcEngine开发demo源码
- C# VS2010 员工信息管理系统
- Chart Control :所有 35 种基本图表
- vs2010 asp.net项目中集成ckeditor和ckfind
- 基于VS2010 C#实现的宿舍管理系统
- C#编写的宿舍管理系统(源码)
- VS2010的RDLC报表使用教程
- C#计算器课程设计报告
- 简单的库存管理系统C# VS2010 SQL2008以
- VS2010C#+SQLserver下的学生选课系统
- VS2010平台下GDAL库
- C#计算器,,有简单,还有科学计算器
评论
共有 条评论