码迷,mamicode.com
首页 > 其他好文 > 详细

利用if else来运行咱们结婚吧

时间:2015-03-28 15:46:08      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:


        static void Main(string[] args)
        {
            while (true)
            {
                string a;
                Console.WriteLine("请问你有房吗:");
                a = Console.ReadLine();
                if (a == "有")
                {
                    Console.WriteLine("请问你有车吗:");
                    a = Console.ReadLine();
                    if (a == "有")
                    {                                                                              //主要运动if else的嵌套。。 注意嵌套的if else 要一块打,不然会很难分清;
                        Console.WriteLine("请问你有钱吗:");
                        a = Console.ReadLine();
                        if (a == "有")
                        {
                            Console.WriteLine("结婚吧");
                        }
                        else
                        {
                            Console.WriteLine("没钱吃什么");
                        }
                    }
                    else
                    {
                        Console.WriteLine("没车你来干什么");
                    }

                }
                else
                {
                    Console.WriteLine("房子都没有住大街上吗");
                }

利用if else来运行咱们结婚吧

标签:

原文地址:http://www.cnblogs.com/lk-kk/p/4374262.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!