Console.WriteLine("請(qǐng)輸入年齡");
int year = Convert.ToInt32(Console.ReadLine());
if (year >= 18)
{ Console.WriteLine("可以查看"); }
if (year < 10)
{ Console.WriteLine("不允許查看"); }
Console.ReadKey();
if (year >= 10 && year < 18)
{ Console.WriteLine("是否繼續(xù)查看(yes曾沈、no)");
string a = Console.ReadLine();
if (a == "yes")
{ Console.WriteLine("請(qǐng)查看"); }
if (a == "no")
{ Console.WriteLine("退出,你放棄查看"); }
Console.ReadKey();
圖片發(fā)自簡(jiǎn)書(shū)App