[英]How can I print a string to the console without a newline at the end?
My question is. 我的问题是。
what is it you type when you want your answer next to your question in c# 如果你想在c#中的问题旁边找到答案,你输入的是什么
I mean like this but you type the answer next to the question. 我的意思是这样,但你在问题旁边输入答案。
string product;
Console.WriteLine("What is the product you want?");
product = Console.ReadLine();
而不是使用Console.WriteLine()
使用Console.Write()
string product;
Console.Write("What is the product you want?");
product = Console.ReadLine();
I believe you're looking for Console.Write("your text here");
我相信你正在寻找Console.Write("your text here");
rather than Console.WriteLine("your text here");
而不是Console.WriteLine("your text here");
It sounds like you're trying to get rid of the newline. 听起来你正试图摆脱新线。
WriteLine
prints a newline. WriteLine
打印换行符。
Write
doesn't. Write
不。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.