• “黑神话·悟空”免安装在线玩,无视显卡等硬件要求!!
  • √ 游戏免下载安装 √ 5分钟随开随玩 √ 关机不计费!低至¥14.90/月!
🔥进入竞技-直面天命🔥

c#写一个计算器程序

时间2023-03-21 20:18:18 提问来自 广东省中山市 的网友 分类创作 浏览244
using System; namespace CalculatorApplication { class NumberManipulator { public void swap(ref int x, ref int y) { int temp; temp = x; /* 保存 x 的值 */ x = y; /* 把 y 赋值给 x */ y = temp; /* 把 temp 赋值给 y */ } static void Main(string[] args) { // 定义变量. int a = 100; int b = 200; Console.WriteLine("在交换前 a 的值:{0}", a); Console.WriteLine("在交换前 b 的值:{0}", b); // 对象创建实例. NumberManipulator n = new NumberManipulator(); // 调用函数来交换两个变量的值. n.swap(ref a, ref b); Console.WriteLine("在交换后 a 的值:{0}", a); Console.WriteLine("在交换后 b 的值:{0}", b); Console.ReadLine(); } }

点击这里,进行内容创作

创作工场 免责声明:
以上内容除特别注明外均来源于网友提问,创作工场回答,未经许可,严谨转载。
点击这里>>使用🔥专业版,更聪明、更完整、更原创!

上一篇 c#计算器代码 下一篇 苏州袁浪荡污染原因及治理对策