gpt4 book ai didi

c# - 相当于c#中的换行符

转载 作者:可可西里 更新时间:2023-11-01 10:53:31 28 4
gpt4 key购买 nike

我应该在我的变量之后放置什么来制作 Console.WriteLine ("You input Y")出现在不同的线路上?这是代码:

static void Main()
{
Console.WriteLine("Welcome to my bool program!");
Console.WriteLine("Input a NON capital y or n please.");

char Y = Console.ReadKey().KeyChar;

if (Y == 'y')
{
Console.WriteLine("You input Y");
}
else
{
if (Y == 'n')
{
Console.WriteLine("You input N");
}
}

Console.WriteLine("Press enter to exit the program, Have a good day!");
Console.ReadLine();
}

谢谢!

最佳答案

你可以使用

Environment.NewLine

这是一个充当换行符的字符串。

或者你可以直接使用

Console.WriteLine()

没有参数,如果你只需要一个换行符。

关于c# - 相当于c#中的换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5414048/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com