标题:求最大值代码 请高手帮忙改动 让程序球玩最大值后出现继续或结束的选项
只看楼主
戒你》如烟
Rank: 1
等 级:新手上路
帖 子:5
专家分:2
注 册:2011-6-27
 问题点数:0 回复次数:0 
求最大值代码 请高手帮忙改动 让程序球玩最大值后出现继续或结束的选项



using System;
namespace Calculateion
{
    class CalculateNumber
    {
        int Number1, Number2, ;
        char option;
        int Result;
        public void Number()
        {
            Console.WriteLine("Enter the First number");
            Number1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the second number");
            Number2 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Main Menu");
            Console.WriteLine("1.Addition");
            Console.WriteLine("2.Subtraction");
            Console.WriteLine("3.Multiplication");
            Console.WriteLine("4.Division");
            Console.WriteLine("Enter the Operation you want to perform");
            option = Convert.ToChar(Console.ReadLine());
               
            switch (option)
            {
                case '1':
                    Result = Number1 + Number2;
                    Console.WriteLine("The result of addition is:{0}",Result);
                    break;
                case '2':
                    Result = Number1 - Number2;
                    Console.WriteLine("The result of subtraction is:{0}",Result);
                   break
                case '3':
                    Result = Number1 * Number2;
                    Console.WriteLine("The result of multiplication is:{0}",Result);
                    break;
                case '4':
                    Result = Number1 / Number2;
                    Console.WriteLine("The result of division is:{0}",Result);
                    break;
                default:
                    Console.WriteLine("Invalid Option");
                   break;
            }
            Console.ReadLine();
                    
        }
               
    }
    class ClassMain
    {
        static void Main(string[] args)
        {
            CalculateNumber obj = new CalculateNumber();
            obj.Number();
        }
    }
}
搜索更多相关主题的帖子: class public number option second 
2011-09-20 08:49



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-350351-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.330846 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved