example1-9.cpp

来自「关于书籍《Borland c++Builder工程实践》的源代码」· C++ 代码 · 共 26 行

CPP
26
字号
#include <iostream.h>
#include <math.h>
void function1(int ,double &,double&,double&);
double sin(),cos(),tan();
void main()
{
int x;
cout<<"Please enter a angle(<90):";
cin>>x;
double sinx,cosx,tanx;
if(x<0||x>=90)
cout<<"You enter a error number ";
else
function1( x, sinx, cosx, tanx);
cout<<"The sin(x)="<<sinx<<endl;
cout<<"The cos(x)="<<cosx<<endl;
cout<<"The tan(x)="<<tanx<<endl;
}
void function1(int x,double &sinx,double &cosx,double &tanx)
{
double  y=3.1415/180*x;
sinx=sin(y);
cosx=cos(y);
tanx=tan(y);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?