码迷,mamicode.com
首页 > Windows程序 > 详细

c# 结婚例子

时间:2015-03-02 20:44:04      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:

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("等你有房有车有钱再说吧");
}

c# 结婚例子

标签:

原文地址:http://www.cnblogs.com/lovesy2413/p/4309536.html

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