using System;
namespace Coding_basics
{
class Program
{
static void Main(string[] args)
{
Console.Title = " To Infinity";
Console.ForegroundColor = ConsoleColor.Green;
int decision = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Welcome");
Console.ReadLine();
Console.WriteLine("You have entered the program, press 1 to proceed or press 2 to leave");
Console.ReadLine();
if (decision == 1 ) { Console.WriteLine("Good luck...");
}
if (decision == 2) { Environment.Exit(0);
}
Console.ReadKey();
}
}
}
我期待的文本出现,然后能够选择1或2继续或关闭游戏,请解释我做错了什么。谢谢
1条答案
按热度按时间lbsnaicq1#
您有太多不需要的
Console.ReadLine()
,您也需要提前声明和读取decision
。您可以尝试以下操作: