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

 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 }

posted @ 2012-09-13 00:59  roytanlu  阅读(183)  评论(0编辑  收藏  举报