How can I print a string to the console without a newline at the end?

后端 未结 4 554
臣服心动
臣服心动 2020-12-11 15:51

My question is.

what is it you type when you want your answer next to your question in c#

I mean like this but you type the answer next to the question.

相关标签:
4条回答
  • 2020-12-11 16:34

    I believe you're looking for Console.Write("your text here"); rather than Console.WriteLine("your text here");

    0 讨论(0)
  • 2020-12-11 16:35

    It sounds like you're trying to get rid of the newline.

    WriteLine prints a newline.
    Write doesn't.

    0 讨论(0)
  • 2020-12-11 16:41
    string product;
    
    Console.Write("What is the product you want?");
    
    product = Console.ReadLine(); 
    
    0 讨论(0)
  • 2020-12-11 16:47

    Instead of using Console.WriteLine() use Console.Write()

    0 讨论(0)
提交回复
热议问题