math.h中的常量
写入如下代码:
#include<iostream>
#include<iomanip>
#define _USE_MATH_DEFINES
#include<math.h>
using namespace std;
int main()
{
system("color 3e");
int a=;
cout<<setprecision();
cout<<"e "<<M_E<<endl;
cout<<"log2(e) "<<M_LOG2E<<endl;
cout<<"log10(e) "<<M_LOG10E<<endl;
cout<<"ln(2) "<<M_LN2<<endl;
cout<<"ln(10) "<<M_LN10<<endl;
cout<<"pi "<<M_PI<<endl;
cout<<"1/pi "<<M_1_PI<<endl;
cout<<"2/pi "<<M_2_PI<<endl;
cout<<"pi/2 "<<M_PI_2<<endl;
cout<<"pi/4 "<<M_PI_4<<endl;
cout<<"sqrt(2) "<<M_SQRT2<<endl;
cout<<"1/sqrt(2) "<<M_SQRT1_2<<endl;
cout<<"2/sqrt(pi) "<<M_2_SQRTPI<<endl;
cout<<"八进制: "<<oct<<a<<endl;
cout<<"十进制: "<<dec<<a<<endl;
cout<<"十六进制: "<<hex<<a<<endl;
cout<<"八进制: "<<setbase()<<a<<endl;
cout<<"十进制: "<<setbase()<<a<<endl;
cout<<"十六进制: "<<setbase()<<a<<endl;
return ;
}
math.h中的常量的更多相关文章
- 自己模拟实现math.h中的函数
之前一直都很迷惑pow()函数时怎么实现的,对于整数次的幂我还能很容易做到,但是对于分数次幂就不是那么好做了.需要一些高等数学级数的知识. 我这里实现了求ln(x), pow(double x, do ...
- C语言中math.h中常用的函数
1.绝对值 ①函数原型: int abs(int x); 函数功能: 求整数x的绝对值 int number=-1234; abs(number); ②函数原型:double fabs(double ...
- 有关linux中,<math.h>的调用方法
h{font-weight:bold;color:green;font-size:105%} p{font-size:100%} linux下C语言程序中,若要用到math.h中的函数(如:sin() ...
- iOS math.h数学函数
在实际工作中有些程序不可避免的需要使用数学函数进行计算,比如地图程序的地理坐标到地图坐标的变换.Objective-C做为ANSI C的扩展,使用C标准库头文件<math.h>中定义的数学 ...
- Objective-C适用C数学函数 <math.h>
在实际工作中有些程序不可避免的需要使用数学函数进行计算,比如地图程序的地理坐标到地图坐标的变换.Objective-C做为ANSI C的扩展,使用C标准库头文件<math.h>中定义的数学 ...
- <math.h>与<float.h>
(一) <math.h> <math.h>文件中已经定义了M_PI,如下所示,用户可以直接使用: //math.h........................ #if de ...
- Standard C 之 math.h和float.h
对于C Standard Library 可以参考:http://www.acm.uiuc.edu/webmonkeys/book/c_guide/ 或者 http://www.cplusplus.c ...
- [Swift]数学库函数math.h | math.h -- mathematical library function
常用数学函数 1. 三角函数 double sin (double);//正弦 double cos (double);//余弦 double tan (double);//正切 2 .反三角函数 d ...
- C 标准库 - <math.h>
C 标准库 - <math.h> 简介 math.h 头文件定义了各种数学函数和一个宏.在这个库中所有可用的功能都带有一个 double 类型的参数,且都返回 double类型的结果. 库 ...
随机推荐
- XML解析方式与解析工具
DOM解析原理: 1)JAXP (oracle-Sun公司官方) 2)JDOM工具(非官方) 3)Dom4J工具(非官方) 三大框架(默认读取xml的工具就是Dom4j) ....... SAX解析原 ...
- HTML5最佳实践
首先先给大家推荐个不错的 前端 网站:http://www.tystudio.net HTML5正迅速称为web前端开发技术标准,作为一名前段开发人员,了解并正确的使用HTML5制作网站变得越来越重要 ...
- C C++ Java中的static
[原文出处]: http://hi.baidu.com/aezealer/blog/item/fb8fdd438113c8169213c6c5.h tml 术语“static”有段不寻常的历史.起初, ...
- LeetCode_Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' - ...
- Android中开发Service
Service的开发分为两个步骤:定义Service和配置Service1.定义Service定义一个Service子类继承于Service2.配置Service在AndroidManifest.xm ...
- 杜教的AAA树
膜膜膜,常数挺小的... #include<iostream> #include<cstdio> #include<cmath> #include<algor ...
- 2015第29周五AOP
AOP使用场景 AOP用来封装横切关注点,具体可以在下面的场景中使用: Authentication 权限 Caching 缓存 Context passing 内容传递 Error handling ...
- Maven Installation
OS:Ubuntu 14.04 Extract the distribution archive, i.e. apache-maven-3.2.2-bin.tar.gz to the director ...
- git与svn对比
git 与 svn 对比 git的使用不需要联机 SVN集中式版本控制:每个人的版本都是提交到服务器,服务器坏了就雪崩.git分布式版本控制: 安全,每人本地有个版本库,每个人都可以充当‘服务器 它 ...
- javascript中闭包的真正作用
参考阮一峰的文章:http://javascript.ruanyifeng.com/grammar/function.html#toc23 1. 读取函数内部变量,封装一些私有属性 function ...