⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class1.cs

📁 C#开发教程 由浅入深 配有实例 是初学者的好帮手
💻 CS
字号:
using System;

namespace MathOps
{
	class MathOpsApp
	{
		[STAThread]
		static void Main(string[] args)
		{
			// The System.Random class is part of the .NET
			// Framework class library. Its default constructor 
			// seeds the Next method using the current date/time.
			Random rand = new Random();
			int a, b, c;
	        
			a = rand.Next() % 100; // Limit max to 99.
			b = rand.Next() % 100; // Limit max to 99.

			Console.WriteLine("a={0} b={1}", a, b);

			c = a * b;
			Console.WriteLine("a * b = {0}", c);

			// Note the following code uses integers. Therefore,
			// if a is less than  b, the result will always
			// be 0. To get a more accurate result, you would 
			// need to use variables of type double or float.
			c = a / b;
			Console.WriteLine("a / b = {0}", c);

			c = a + b;
			Console.WriteLine("a + b = {0}", c);

			c = a - b;
			Console.WriteLine("a - b = {0}", c);

			c = a % b;
			Console.WriteLine("a % b = {0}", c);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -