Console.WriteLine("请输入你的年龄");
string yourage = Console.ReadLine();
int age = Convert.ToInt32(yourage);
if (age >= 18)
{
Console.WriteLine("你可以继续可以查看");
}
else if (age < 10)
{
Console.WriteLine("很抱歉,你不允许查看");
}
else
{
Console.WriteLine("是否继续查看?请输入yes or no");
string xuanze = Console.ReadLine();
if (xuanze == "yes")
{
Console.WriteLine("你可以继续查看");
}
else
{
Console.WriteLine("你放弃查看");
}
}
Console.ReadKey();