ITeye博客

DecimalTest

kanglecjr · 2009-07-06 10:32 · C# · C · Linq · C++ · C# · Markdown


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DecimalTest
{
    class Program
    {
        static void Main(string[] args)
        {
            decimal x;
            double y;
            x = 3.14159265358979323m;

            x = x / 3;

            y = (double)x;

            Console.WriteLine("x={0}", x);

            Console.WriteLine("y={0}", y);

            Console.ReadKey();

        }
    }
}


注意:定义 Decimal 变量时, 数字后面应该带有 m 或 M。

结果: x=1.0471975511965977433333333333 y=1.0471975511966

诚品服饰 英伦男装 无条件退换

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。