基本上,我是编程新手,因为您将能够看到一切正常,直到我想询问细节是否正确为止,无论我输入的内容是什么,都会使细节一直正确,我想可以在确认中输入是或否。我非常感谢有人向我解释这一点,以便我可以正确使用布尔
namespace UserFeedBack.cs
{
class MainClass
{
static void Main(string[] args)
{
Console.Write("Enter your name : ");
string Name = Console.ReadLine();
Console.WriteLine("Hey there, " +Name );
Console.ReadLine();
Console.Write("How old are you : ");
string Age = Console.ReadLine();
Console.WriteLine(" Hello " + Name + " you are " + Age + "!");
Console.Write("bank card account number :");
string AccountNumber = Console.ReadLine();
Console.WriteLine("Thank you! to confirm, is your account number : " + AccountNumber);
Console.ReadLine();
bool y = true;
if (y)
{
Console.WriteLine("Thank you, we can confirm your details are correct");
}
else
{
Console.WriteLine("re enter your details : ");
}
Console.ReadLine();
}
}
}
答案 0 :(得分:0)
您已经声明了bool属性iptables -A FILTERS -p tcp --dport 25 -m conntrack --ctstate NEW --ctorigdstport 465 -j ACCEPT
,并且这样做将bool的值始终设置为true。您需要做的是评估用户使用bool y = true;
键入的内容。如果用户键入“是”,则将属性更改为true,否则将其更改为false,如下所示:
Console.ReadLine()