|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
小甲鱼,你再不出C#课我就吃了你
记得还有WPF
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace CSharp登陆
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("你要计算的第一个数:");
- int fNum = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("你要计算的第二个数:");
- int sNum = Convert.ToInt32(Console.ReadLine());
- do
- {
- Console.WriteLine("你要使用什么运算:(1.加法 2.减法 3.乘法 4.除法)");
- int choose = Convert.ToInt32(Console.ReadLine());
- if (choose == 1)
- {
- int ans = fNum + sNum;
- Console.WriteLine("结果是:" + ans);
- }
- else if (choose == 2)
- {
- int ans = fNum - sNum;
- Console.WriteLine("结果是:" + ans);
- }
- else if (choose == 3)
- {
- int ans = fNum * sNum;
- Console.WriteLine("结果是:" + ans);
- }
- else if (choose == 4)
- {
- int ans = fNum / sNum;
- int ans2 = fNum % sNum;
- Console.WriteLine("结果是:{0}……{1}", ans, ans2);
- }
- else
- {
- Console.WriteLine("请输入正确的数字选项!");
- }
- }
- while (true);
- Console.ReadKey();
- }
- }
- }
复制代码 |
|