#代碼
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入年齡");
? ? ? ? ? ? int age = Convert.ToInt32(Console.ReadLine());
? ? ? ? ? ? if (age >= 18)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("可以查看");
? ? ? ? ? ? }
? ? ? ? ? ? else if (age < 10)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("不可以查看");
? ? ? ? ? ? }
? ? ? ? ? ? else if (age >= 10 && age < 18)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("是否繼續(xù)查看(輸入yes/no)");
? ? ? ? ? ? ? ? string s = Console.ReadLine();
? ? ? ? ? ? ? ? if (s == "yes")
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)查看");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else if (s == "no")
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.WriteLine("退出,你放棄查看");
? ? ? ? ? ? ? ? }?
? ? ? ? ? ? }
? ? ? ? ? ? Console.WriteLine("程序結(jié)束");
? ? ? ? ? ? Console.ReadKey();
? ? ? ? }
? ? }
}
#效果
