⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arg.cpp

📁 数据结构常用算法合集
💻 CPP
字号:
//arg.cpp
// Illustrate the use of each of the complex friend functions.
#include <complex.h>  // This also includes iostream.h.
#include <conio.h>
void main(void)
{
   complex<double> z(3.1, 4.2);
   cout << "z = " << z << "\n";
   cout << "  实数部分 = " << real(z) << "\n";
   cout << "  虚数部分 = " << imag(z) << "\n";
   cout << "z 的共扼复数= " << conj(z) << "\n";

   double mag = sqrt(norm(z));
   double ang = arg(z);

   cout << "z的极坐标:\n";
   cout << "大小 = " << mag << "\n";

   cout << "角弧度 = " << ang << "\n";
   cout << "有极坐标再转换为复数:\n";
   cout << "   z = " << polar(mag,ang) << "\n";
   getch();
}

⌨️ 快捷键说明

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