小编Ana*_*3ma的帖子

C#中的美元金额

我查看了其他一些帖子,但似乎没有任何帮助.所以我想要的是一个代码,用一个美元金额读出当前的余额,前面有一个短语.而不是打印美元符号其打印{0:C}.我使用{0:C}不正确吗?

namespace ConsoleApplication7
{
    class Program
    {
        static void Main(string[] args)
        {
            double TotalAmount;
            TotalAmount = 300.7 + 75.60;
            string YourBalance = "Your account currently contains this much money: {0:C} " + TotalAmount;
            Console.WriteLine(YourBalance);
            Console.ReadLine();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

c# currency string-formatting

0
推荐指数
1
解决办法
986
查看次数

标签 统计

c# ×1

currency ×1

string-formatting ×1