为了账号安全,请及时绑定邮箱和手机立即绑定

帮我看看为什么输入不了运算符号那步

                    做了个计算器程序,但是输入运算符号那步直接跳过去了

                    Console.WriteLine("请输入第一个数");
                    float oneNumberInCalculator;
                    oneNumberInCalculator = Console.Read();
                    Console.WriteLine("请输入运算符号");
                    Console.WriteLine("1为加,2为减,3为乘,4为除");
                    int arithmeticSymbol;
                    arithmeticSymbol = Console.Read();
                    if (arithmeticSymbol == 1)
                    {
                        Console.WriteLine("请输入第二个数");
                        float twoNumberInCalculater;
                        twoNumberInCalculater = Console.Read();
                        Console.WriteLine("运算结果为");
                        Console.WriteLine(oneNumberInCalculator + twoNumberInCalculater);
                    }
                    if (arithmeticSymbol == 2)
                    {
                        Console.WriteLine("请输入第二个数");
                        float twoNumberInCalculater;
                        twoNumberInCalculater = Console.Read();
                        Console.WriteLine("运算结果为");
                        Console.WriteLine(oneNumberInCalculator - twoNumberInCalculater);
                    }
                    if (arithmeticSymbol == 3)
                    {
                        Console.WriteLine("请输入第二个数");
                        float twoNumberInCalculater;
                        twoNumberInCalculater = Console.Read();
                        Console.WriteLine("运算结果为");
                        Console.WriteLine(oneNumberInCalculator * twoNumberInCalculater);
                    }
                    if (arithmeticSymbol == 4)
                    {
                        Console.WriteLine("请输入第二个数");
                        float twoNumberInCalculater;
                        twoNumberInCalculater = Console.Read();
                        Console.WriteLine("运算结果为");
                        Console.WriteLine(oneNumberInCalculator / twoNumberInCalculater);
                    }

正在回答

1 回答

Read

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

帮我看看为什么输入不了运算符号那步

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信