C ++复数,正确的格式是什么?

2022-01-17 00:00:00 numbers number-formatting c++

我想用 C++ 处理复数.因此我包含了 #include <complex>.现在我的问题是:我如何声明一个变量?(那么我们所说的格式是什么:1 + i?)

I want to use C++ with complex numbers. Therefore I included #include <complex>. Now my question is: How do I declare a variable?(so what is the format called for let's say: 1 + i?)

提前致谢:-)

推荐答案

// 1 + 2i
std::complex<double> c(1, 2);

相关文章