#include <iostream>
#include <windows.h>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#define PI 3.1415926
using namespace std;
double inv(double a)
{
return tan(a)-a;
}
int main()
{
int i;
while(1)
{
std::cout<<"****************************"<<endl;
std::cout<<"*请输入要计算的项目序号: *"<<endl;
std::cout<<"*0.退出程序. *"<<endl;
std::cout<<"*1.渐开线函数值. *"<<endl;
std::cout<<"*2.反渐开线函数. *"<<endl;
std::cout<<"*3.渐开线函数的比值. *"<<endl;
std::cout<<"****************************"<<endl;
std::cin>>i;
system("cls");
switch(i)
{
case 0:return 0;
case 1:
{
double a;
std::cout<<"请输入十进制压力角:";
std::cin>>a;
std::cout<<"渐开线函数值:"<<inv(a*PI/180)<<endl;
}break;
case 2:
{
double sum,a,b,c;
std::cout<<"请输入渐开线函数值:";
std::cin>>sum;
a=0;b=atan(1.0)*2;
while(b-a>1e-12)
{
c=(a+b)/2;
inv(c)>sum?b=c:a=c;
}
std::cout<<"反渐开线函数值为:"<<(a+b)/2/atan(1.0)*45<<"度"<<endl;
} break;
case 3:
{
double a,b;
std::cout<<"请输入法向压力角值:";
std::cin>>a;
std::cout<<"请输入螺旋角的值:";
std::cin>>b;
std::cout<<"渐开线函数的比值"<< fixed << setprecision(6) <<inv(atan(tan(a*PI/180)/cos(b*PI/180)))/inv(a*PI/180)<<endl;
}break;
}
}
system("pause");
}
渐开线函数工具
最新推荐文章于 2024-06-02 11:41:13 发布