c# 结婚例子
Console.Title = "结婚例子";
bool a, b, c;
string y;
Console.WriteLine("有房?(Y/N)");
y = Console.ReadLine();
a = Convert.ToBoolean((y == "y" || y == "Y") ? 1 : 0);
Console.WriteLine("有车?(Y/N)");
y = Console.ReadLine();
b = Convert.ToBoolean((y == "y" || y == "Y") ? 1 : 0);
Console.WriteLine("有钱?(Y/N)");
y = Console.ReadLine();
c = Convert.ToBoolean((y == "y" || y == "Y") ? 1 : 0);
if (a&b&c)
{
Console.WriteLine("可以继续了解");
}
else if(a&b)
{
Console.WriteLine("等有钱了再说吧");
}
else if (a&c)
{
Console.WriteLine("等你有车再说吧");
}
else if (b&c)
{
Console.WriteLine("等你房再说吧");
}
else if (a)
{
Console.WriteLine("等你有车有钱再说吧");
}
else if (b)
{
Console.WriteLine("等你有房有钱再说吧");
}
else if (c)
{
Console.WriteLine("等你有房有车再说吧");
}
else
{
Console.WriteLine("等你有房有车有钱再说吧");
}