How to print Text and value from integer on the same line in the console?

后端 未结 2 873
一向
一向 2021-01-14 14:04

This is what I do, but it didn\'t work:

int money;
Console.Writeline(\"Enter how much money you want\";
money=int.Parse(Console.ReadLine());
Console.Writeli         


        
2条回答
  •  情话喂你
    2021-01-14 14:31

    As of C# 6, this can be written as:

    Console.Writeline($"The Money you have now are: {money}");
    

    See: $ - string interpolation (C# reference)

提交回复
热议问题