qcode
  • 创作工场专业版,一问多答!更智能、更完整、更原创
  • 这是一个超强内容创作平台,它会写文章、做设计、绘图、敲代码,有问必答!
🔥点击使用-高级专业版🔥

c#写一个计算器程序

时间2023-03-21 20:18:18 提问来自 广东省中山市 的网友 分类创作 浏览334
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#计算器代码 下一篇 一日八百传佳音