如PI=3.1415……,在提供半径 r 后,周长 double C = 2*PI*r,此时,我想精确到 C 小数点后的两位,这里请教了!
解决方案 »
- 这些代码为什么要这样写呢?
- Windows窗体编程时用的Properties.Settings.Default在Windows Mobile窗体编程时用什么代替呢
- C#WinForm显示
- P2P点到点UDP穿透ADSL猫路由自动拨号的情况下,而且属于NAT之后是如何通信的?有高手进来看看。在这发过一次,没有解答啊。给100分
- c#日期问题
- 求解!运行错误: 当前上下文中不存在名称“FontDialog1”
- 如何令在picturebox上画的rectangle,在picturebox上image的移动下,都保持在原本位置不移动
- GUID的问题.
- 已知完全的文件名,求如何分解该文件名,以得到文件名,文件扩展名,目录等资料。
- 为什么会出错啊???
- 如何在跳转到另一窗口时关闭原窗口
- C# WinForm中回车如何控制所有控件的焦点
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml;
using System.Collections;namespace ConsoleApplication1
{
class Program
{ public Program()
{
const double PI=3.1415;
//假设半径为3
double c = 2 * PI * 3;
Console.WriteLine(Math.Round(c, 2));
} static void Main(string[] args)
{
Program p1 = new Program();
Console.ReadLine();
}
}
}
C=Convert.ToDouble(C.ToString("F2"));