📜  acos()函数,用于C++中的复数

📅  最后修改于: 2021-05-30 16:30:39             🧑  作者: Mango

复杂头文件中定义了用于复杂数字的acos()函数。此函数是acos()函数的复杂版本。此函数用于计算复数z的复数反余弦,并返回复数z的反余弦。

句法:

template complex 
       acos (const complex& z );

参数:此方法接受代表复数的强制性参数z

返回值:该函数返回复数z的反余弦

下面的程序说明了C++中的acos()函数:

范例1:-

// c++ program to demonstrate
// example of acos() function.
  
#include 
using namespace std;
  
// driver program
int main()
{
    complex complexnumber(-2.0, 0.0);
  
    // use of acos() function for complex number
    cout << "The acos of "
         << complexnumber
         << " is "
         << acos(complexnumber)
         << endl;
  
    return 0;
}
输出:
The acos of (-2,0) is (3.14159,-1.31696)

示例2:

// c++ program to demonstrate
// example of acos() function.
  
#include 
using namespace std;
  
// driver program
int main()
{
    complex complexnumber(-2.0, -0.0);
  
    // use of acos() function for complex number
    cout << "The acos of "
         << complexnumber
         << " is "
         << acos(complexnumber)
         << endl;
  
    return 0;
}
输出:
The acos of (-2,-0) is (3.14159,1.31696)
要从最佳影片策划和实践问题去学习,检查了C++基础课程为基础,以先进的C++和C++ STL课程基础加上STL。要完成从学习语言到DS Algo等的更多准备工作,请参阅“完整面试准备课程”