这就是我所做的,但没有奏效:
int money;
Console.Writeline("Enter how much money you want";
money=int.Parse(Console.ReadLine());
Console.Writeline("The Money you have now are",money)
最佳答案
您有多种选择:
Console.Writeline("The Money you have now are" + money);
Console.WriteLine
的格式说明符版本:Console.Writeline("The Money you have now are: {0}", money);
Console.Write
反而:Console.Write("The Money you have now are: ");
Console.Writeline(money);
笔记:
由于缺少括号、分号和不正确的大小写,您的代码实际上并未编译。我会把你的代码写成这样:
Console.WriteLine("Enter how much money you want");
int money = int.Parse(Console.ReadLine());
Console.WriteLine("The Money you have now is {0}", money);
关于c# - 如何在控制台的同一行上从整数打印文本和值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30375736/