基本信息
源码名称:C# 计算器Demo源码下载
源码大小:0.06M
文件格式:.rar
开发语言:C#
更新时间:2016-02-20
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 1 元 
   源码介绍

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 计算器
{
    class Calc
    {
        private double number1 = 0;  //第1个数
        private double number2 = 0;  //第2个数
        private double number3 = 0;  //结果
        public enum Sign { And, Substract, Multiply, Divide, Sign }  //加减乘除符号枚举
        
        public string Process { get; set; }  //计算记录
        
        public Calc()
        {

        }

        public double Number1
        {
            get { return number1; }
            set { number1 = value; }
        }
        public double Number2
        {
            get { return number2; }
            set { number2 = value; }
        }
        public double Number3
        {
            get { return number3; }
            set { number3 = value; }
        }

        public void Calc_method(Sign sign)
        {
            switch (sign)
            {
                case Sign.And:  //加法
                    number3 = number1   number2;
                    break;
                case Sign.Divide: //除法
                    number3 = number1 / number2;
                    break;
                case Sign.Multiply: //乘法
                    number3 = number1 * number2;
                    break;
                case Sign.Substract: //减法
                    number3 = number1 - number2;
                    break;
            }
        }


    }
}