条件都判断完才能判断有车有房有钱才能结婚,if嵌套用法举例

namespace ConsoleApplication24
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
            Console.Write("请问有没有房子?:");
            string a = Console.ReadLine();

            if (a=="")
            {
                Console.Write("请问有没有车子?:");//层层递进,满足第一个才能执行,一个不满足就跳出
                string b = Console.ReadLine();
                if (b=="")
                {
                    Console.Write("请问有没有钱?:");
                    string c = Console.ReadLine();
                    if (c=="")
                    {
                        Console.WriteLine("那就结婚吧!");
                    }
                    else if(c=="没有")
                    {
                        Console.WriteLine("你走开!本女神还在等下一位呢");
                    }
                    else
                    {
                        Console.WriteLine("请只回答有或者没有!");
                    }
                }
                else if(b=="没有")
                {
                    Console.WriteLine("你走开!本女神还在等下一位呢");
                }
                else
                {
                    Console.WriteLine("请只回答有或者没有!");
                }
            }
            else if(a=="没有")
            {
                Console.WriteLine("你走开!本女神还在等下一位呢");
            }
            else
            {
                Console.WriteLine("请只回答有或者没有!");
            }
            }
            
        }
    }
}
二百个不间断的重复,只是让我看到了人的命运无法改变这一事实而已。
原文地址:https://www.cnblogs.com/dlexia/p/4373999.html