• 大小: 71KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-17
  • 语言: 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 JiSuanQi
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void buttonNum_Click(object sender EventArgs e)
        {
            richTextBox1.Focus();
            if (prC == 5)
                return;
            if (prC == 3)
                return;
            Button clickBtn;
            restart = 1;
            richTextBox1.Text = ““;
            clickBtn = (Button)sender;
            if (num == “0“)
            {
                num = clickBtn.Text;
            }
            else
            {
                    num += clickBtn.Text;
            }
            richTextBox1.Text = boxText;
            richTextBox1.AppendText(“\r\n“ + num);
            prC = 0;
            //textBox1.Select(textBox1.TextLength 0);//光标定位到文本最后
            //textBox1.ScrollToCaret();
        }

        private void buttonChar_Click4(object sender EventArgs e)  //响应“.“
        {
            richTextBox1.Focus();
            if (prC == 5)
                return;
            if (isOnePoint == 1)
                return;
            Button clickBtn;
            restart = 1;
            clickBtn = (Button)sender;
            num += clickBtn.Text;
            richTextBox1.Text = boxText;
            richTextBox1.AppendText(“\r\n“ + num);
            prC = 4;
            isOnePoint = 1;
        }

        private void buttonChar_Click1(object sender EventArgs e)  //响应“(”;
        {
            richTextBox1.Focus();
            if (prC == 5)
                return;
            if (prC == 4)
                return;
            if (prC == 0 && restart == 1)
                return;
            if (prC == 3)
                return;
            Button clickBtn;
            clickBtn = (Button)sender;
            int i = 0;
            while (formData.arr.ElementAt(i) != “=“)
                i++;
            formData.arr.Insert(i  clickBtn.Text);
            boxText += clickBtn.Text;
            num = “0“;

            richTextBox1.Text = boxText;
            richTextBox1.AppendText(“\r\n0“);
            cNum++;
            prC = 2;
            isOnePoint = 0;
        }
        private void buttonChar_Click2(object sender EventArgs e)   //响应“)”;
        {
            richTextBox1.Focus();
            if (prC == 4)
                return;
            if (cNum == 0)
                return;
            if (prC == 1)
                return;
            Button clickBtn;
            clickBtn = (Button)sender;
            int i = 0;
            double dnum = Convert.ToDouble(num);
            while (formData.arr.ElementAt(i) != “=“)
                i++;
            if (prC == 3 || prC == 5)
       

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      35328  2010-04-07 19:05  JiSuanQi\JiSuanQi\bin\Debug\JiSuanQi.exe

     文件      40448  2010-04-07 19:05  JiSuanQi\JiSuanQi\bin\Debug\JiSuanQi.pdb

     文件      14328  2010-04-15 12:50  JiSuanQi\JiSuanQi\bin\Debug\JiSuanQi.vshost.exe

     文件        490  2009-06-11 05:14  JiSuanQi\JiSuanQi\bin\Debug\JiSuanQi.vshost.exe.manifest

     文件      17715  2010-04-07 19:05  JiSuanQi\JiSuanQi\Form1.cs

     文件      27459  2010-04-07 19:05  JiSuanQi\JiSuanQi\Form1.Designer.cs

     文件      22328  2010-04-07 19:05  JiSuanQi\JiSuanQi\Form1.resx

     文件        494  2010-03-25 18:54  JiSuanQi\JiSuanQi\FormData.cs

     文件       3801  2010-03-25 17:19  JiSuanQi\JiSuanQi\JiSuanQi.csproj

     文件       1662  2010-04-15 12:50  JiSuanQi\JiSuanQi\obj\Debug\JiSuanQi.csproj.FileListAbsolute.txt

     文件        847  2010-04-07 19:05  JiSuanQi\JiSuanQi\obj\Debug\JiSuanQi.csproj.GenerateResource.Cache

     文件      35328  2010-04-07 19:05  JiSuanQi\JiSuanQi\obj\Debug\JiSuanQi.exe

     文件      11372  2010-04-07 19:05  JiSuanQi\JiSuanQi\obj\Debug\JiSuanQi.Form1.resources

     文件      40448  2010-04-07 19:05  JiSuanQi\JiSuanQi\obj\Debug\JiSuanQi.pdb

     文件        180  2010-04-07 19:05  JiSuanQi\JiSuanQi\obj\Debug\JiSuanQi.Properties.Resources.resources

     文件        489  2010-03-25 15:28  JiSuanQi\JiSuanQi\Program.cs

     文件       1348  2010-03-24 21:27  JiSuanQi\JiSuanQi\Properties\AssemblyInfo.cs

     文件       2866  2010-03-24 21:27  JiSuanQi\JiSuanQi\Properties\Resources.Designer.cs

     文件       5612  2010-03-24 21:27  JiSuanQi\JiSuanQi\Properties\Resources.resx

     文件       1093  2010-03-24 21:27  JiSuanQi\JiSuanQi\Properties\Settings.Designer.cs

     文件        249  2010-03-24 21:27  JiSuanQi\JiSuanQi\Properties\Settings.settings

     文件        914  2010-03-25 08:09  JiSuanQi\JiSuanQi.sln

    ..A..H.     22016  2010-04-15 12:50  JiSuanQi\JiSuanQi.suo

     目录          0  2010-03-24 23:35  JiSuanQi\JiSuanQi\obj\Debug\Refactor

     目录          0  2010-03-24 21:27  JiSuanQi\JiSuanQi\obj\Debug\TempPE

     目录          0  2010-04-07 23:31  JiSuanQi\JiSuanQi\bin\Debug

     目录          0  2010-04-07 23:31  JiSuanQi\JiSuanQi\obj\Debug

     目录          0  2010-04-07 23:31  JiSuanQi\JiSuanQi\bin

     目录          0  2010-04-07 23:31  JiSuanQi\JiSuanQi\obj

     目录          0  2010-04-07 23:31  JiSuanQi\JiSuanQi\Properties

............此处省略5个文件信息

评论

共有 条评论