35 lines
662 B
C#
35 lines
662 B
C#
|
|
|
|
#define Unity2017
|
|
#define Unity2020
|
|
|
|
|
|
namespace Lesson19_预处理器指令练习
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
Console.WriteLine("请输入第一个数字:");
|
|
int a = int.Parse(Console.ReadLine());
|
|
|
|
Console.WriteLine("请输入第二个数字:");
|
|
int b = int.Parse(Console.ReadLine());
|
|
Console.WriteLine(Calc(a, b));
|
|
|
|
}
|
|
static int Calc(int a, int b)
|
|
{
|
|
#if Unity5
|
|
return a + b;
|
|
#elif Unity2017
|
|
return a*b;
|
|
#elif Unity2019
|
|
return a-b;
|
|
#else
|
|
return 0;
|
|
#endif
|
|
}
|
|
}
|
|
}
|