设为首页 加入收藏

TOP

VC中使用数学常量M_PI
2014-11-14 21:30:26 来源: 作者: 【 】 浏览:18
Tags:使用 数学 常量 M_PI

  GCC,Turbo C中可以通过包含头文件math.h就可以直接使用圆周率 M_PI 了。


  很多人说在VC里面是行不通的。


  其实,只要你查看math.h,就知道,只需加上一条#define _USE_MATH_DEFINES就可以了


  #include "stdafx.h"


  #define _USE_MATH_DEFINES


  #include


  #include


  #include


  int _tmain(int argc, _TCHAR* argv[])


  {


  printf( "An approximation of Pi is %f\n", M_PI);


  system("PAUSE");


  return 0;


  }


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇const用法详解 下一篇C++二进制文件读写

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: