⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program.cs

📁 这是自己写的很简单的程序代码,很简单!!希望你能看上
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;

namespace calculate
{
    class Program
    {
        static void Main(string[] args)
        {
            int a;
            double b,c;
            Console.WriteLine("请选择要进行的计算:1加2减3乘4除");
            try
            {
                a = Convert.ToInt32(Console.ReadLine());
                switch (a)
                {
                    case 1:
                        Console.WriteLine("第一个操作数:");
                        b = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("第二个操作数:");
                        c = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("{0}+{1}={2}", b, c, b + c);
                        break;
                    case 2:
                        Console.WriteLine("第一个操作数:");
                        b = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("第二个操作数:");
                        c = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("{0}-{1}={2}", b, c, b - c);
                        break;
                    case 3:
                        Console.WriteLine("第一个操作数:");
                        b = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("第二个操作数:");
                        c = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("{0}*{1}={2}", b, c, b * c);
                        break;
                    case 4:
                        Console.WriteLine("第一个操作数:");
                        b = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("第二个操作数:");
                        c = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("{0}/{1}={2}", b, c, b / c);
                        break;
                    default:
                        Console.WriteLine("输入错误!");
                        break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -