• 如何在终端上打出货币符号和算式


     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 
     6 namespace ConsoleApplication5
     7 {
     8     class Program
     9     {
    10         static void Main(string[] args)
    11         {
    12             float i = 44.44f;//不能隐式地将 Double 类型转换为“float”类型;请使用“F”后缀创建此类型
    13             float j = 12.7f;
    14             //{0,8:C2},0为占位符,8为字符宽度,C为货币格式,2为小数位数;
    15             Console.WriteLine("{0,8:C2}\n+{1,7:C2}\n---------\n{2,8:C2}", i, j, i + j);
    16         }
    17     }
    18 }

  • 相关阅读:
    去重
    JavaScript 数组
    变量
    2017.3.19 for
    2017.3.19 if,for
    2017.3.14
    2017.3.10
    2017.3.9
    2017.3.7-1
    2017.3.7
  • 原文地址:https://www.cnblogs.com/roytanlu/p/2682705.html
Copyright © 2020-2023  润新知