2018-11-01(if+else)(4)

        Console.WriteLine("请输入用户年龄");
        int age = Convert.ToInt32(Console.ReadLine());
        if (age >= 18)
        {
            Console.WriteLine("可以查看");
        }
        if (age < 10)
        {
            Console.WriteLine("不允许查看");

        }
        if(age<18 && age>=10)
        {Console .WriteLine ("是否继续查看(yes or no)");
        }
         string a=Console .ReadLine ();
        if(a =="yes")
        {Console .WriteLine ("请用户查看");
        }
         if(a =="no")
        {Console .WriteLine ("退出,你放弃查看");
        }

        Console.ReadKey ();

你可能感兴趣的:(2018-11-01(if+else)(4))