添加Lesson19
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user