我已经看到了其他问题,但答案似乎很复杂,无法理解它们,所以继承我的代码:
注意:我是c shar语言的新手
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Input_Program
{
class Program
{
private static void Main()
{
Console.WriteLine("Welcome to my bool program!");
Console.WriteLine("Input a NON capital y or n when told to.");
char Y;
char N;
if(Y = 'y')
{}
}
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢,谢谢
在我的变量之后放置什么以使其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();
}
Run Code Online (Sandbox Code Playgroud)
谢谢!