计应191西 曲明明 第三组



using system;
using system.collections.generic;
using system.linq;
using system.text;
using system.threading.tasks;

namespace consoleapplication3
{
    class program
    {
        static void main(string[] args)
        {
            console.writeline("第一个数:");
            int a = convert.toint32(console.readline());

            console.writeline("输入运算符(+—*/)");        
          //  c=console.readline();
            char str=convert.tochar(console.readline());

            console.writeline("第er个数:");
            int b = int32.parse(console.readline());

            //int c = a + b;
            //console.writeline("两个数和为:{0}",c);

            switch (str) {
                case '+':
                    console.writeline("两个数和为:{0}", a+b);

                    break;
                case '-':
                    console.writeline("两个数差为:{0}", a-b);
                    break;
                case '*':
                    console.writeline("两个数积为:{0}", a*b);
                    break;
                case '/':
                    console.writeline("两个数商为:{0}", a/b);
                    break;
                case '%':
                    console.writeline("两个数余数为:{0}", a % b);
                    break;
                default:
                    console.writeline("输入正确的运算符!!");
                    break;

            }

        }
    }
}

 

posted @ 2021-05-31 23:12  计应191西三组  阅读(28)  评论(0编辑  收藏  举报