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

📅  最后修改于: 2021-05-30 02:13:13             🧑  作者: Mango

复数头文件中定义了复数log10()函数。此函数是log10()函数的复杂版本。此函数用于计算复数z(即以10为底)的复数公共日志,并返回复数z的公共日志。

句法:

template complex 
       log10 (const complex& z );

参数:此方法采用必填参数z ,它代表复数。

返回值:该函数返回复数z的公共日志

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

范例1:-

// c++ program to demonstrate
// example of log10() function.
  
#include 
using namespace std;
  
// driver program
int main()
{
    // initializing the complex: (-1.0+0.0i)
    complex complexnumber(-1.0, 0.0);
  
    // use of log10() function for complex number
    cout << "The log10 of "
         << complexnumber
         << " is "
         << log10(complexnumber)
         << endl;
  
    return 0;
}
输出:
The log10 of (-1,0) is (0,1.36438)

示例2:

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