首先,这个问题不是
System.Console.Write instead of System.Console.WriteLine
....
<Console.Write();>: <Console.ReadLine>
我认为这最好地解释了我的问题,
我有...
string stringone = Console.ReadLine();
string stringtwo = Console.ReadLine();
....
//what it does
<Console.ReadLine> (after enter is pressed moves to next line)
<Console.ReadLine>
//what I want
<Console.ReadLine> <Console.ReadLine>
如果可能的话,任何替代/解决方案或理由都非常值得赞赏。
最佳答案
using System;
class Test
{
static void Main()
{
//split input by spaces into array
string[] name = Console.ReadLine().Split();
Console.WriteLine("First name: " + name[0]);
Console.WriteLine("Last Name: " + name[1]);
}
}
关于c# - 读取输入与另一个读取输入在同一行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32060882/