本文介绍了C#控制台程序写一个计算器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
控制台程序写入acalculator以满足加法和减法乘法
我尝试过:
Console.Write(请输入数A);
float n = float.Parse(Console.ReadLine());
Console.WriteLine();
// Console.Write(请选择符号(+, - ,*,/,%):);
Console.WriteLine();
Console.Write(请输入数B);
float m = float.Parse(Console.ReadLine());
string k =;
switch(k)
{
case*:float x = m * n;打破;
case/:float y = m / n;打破;
case+:float z = m + n;打破;
case - :float w = m - n;打破;
case%:float q = m%n;打破;
}
//Console.Write();
解决方案
The console program writes acalculator to satisfy addition and subtraction multiplication
What I have tried:
Console.Write("请输入数A"); float n = float.Parse(Console.ReadLine()); Console.WriteLine(); // Console.Write("请选择符号(+,-,*,/,%):"); Console.WriteLine(); Console.Write("请输入数B"); float m = float.Parse(Console.ReadLine()); string k = ""; switch (k) { case "*": float x = m * n; break; case "/": float y = m / n; break; case "+": float z = m + n; break; case "-": float w = m - n; break; case "%": float q = m % n; break; } //Console.Write("");
解决方案
这篇关于C#控制台程序写一个计算器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!