7

7四:math[1].h的简单用法(菜鸟编程教学4)

文档

0.8

已售 0
187.64KB

数据标识:D17207912451765385

发布时间:2024/07/12

数据描述

目录
Content
Chapter_1
Chapter_1
我们直接举个小例子了解一下这个头文件的用法!
下面我举个程序小说明一下就可以了:
#include
#include
#include
main()
{
double x,y;
x = 30.00;
y = 60.00;
printf("\n ==> x = %lf\t y = %lf \n",x,y);//输出 x 与 y 的初始值
//sine of x, x in radians
printf("\n ==> sin(x) = %lf \n",sin(x));
//cosine of x, x in radians
printf("\n ==> cos(x) = %lf \n",cos(x));
//arctangent of y/x, in radians
printf("\n ==> y/x = %lf \n",atan2(y,x));
//exponential function ex
printf("\n ==> e 的 x 次方= %lf \n",exp(x));
//natural (base e) logarithm of x (x>0)
printf("\n ==> log(x) = %lf \n",log(x));
//common (base 10) logarithm of x (x>0)
printf("\n ==> log10(x) = %lf \n",log10(x));
//x^y
printf("\n ==> x 的 y 次方 = %lf \n",pow(x,y));
//square root of x (x>0)
printf("\n ==> 根号 x = %lf \n",sqrt(x));
//absolute value of |x|
printf("\n ==> x 的绝对值 = %lf \n",fabs(x));
getchar();
}
//这里就是头文件的具体用法,程序大家一看便知意思,就不加以讲解了。
//在此我们用c++顺便举个三角函数精确求法的简单例子:
#include
#include
#include
using namespace std;
const double pi(3.1415926535897932384626433832795);
//这里是C++一种赋值方式,不用“=”也是可以的
int main()
{
system("@echo off");
system("title 角度计算器 By:opencTM.");
system("color 3f");
cout<<'\n'<计算sin,cos,tan角度的计算器,可以精确到万亿分位!"<cout<<'\n'<cout<<'\n'<请按任意继续..."<<'\n'<system("pause >nul");
system("color 5f");
double a,b;
cout<<"==>请输入角度:";
cin>>a;
system("color 97");
b=a*pi/180;
cout<<"==>十进制的表示的一般准确值:"<<'\n';
cout<cout<cout<cout<<"==>八进制的表示的较精确值:"<<'\n';
cout<cout<cout<cout<<"==>十六进制的表示的欠精确值:"<<'\n';
cout<cout<cout<cout<感谢您的使用,请直接关闭."<cin>>ws;//提取空白符.
return 0;
}
//实际在角度这里没有转换,呵呵~原因:不是可转换的数据类型

验证报告

卖家暂未授权典枢平台对该文件进行数据验证,您可以向卖家

申请验证报告

data icon
7四:math[1].h的简单用法(菜鸟编程教学4)
0.8
已售 0
187.64KB
申请报告