cout << "a = " << a << ", b = " << b << endl;
cout << "a + b = " << a + b << endl;
cout << "a * b = " << a * b << endl;
cout << "
the real part of a is " << real(a) << endl;
cout << "the imaginary part of b is " << imag(b) << endl;
cout << "the magnitude of a is " << abs(a) << endl;
#include <complex>
using namespace std;
int main(int argc, char *argv[])
{
complex<double> a(1, 2), b(3, 4);
cout << "a = " << a << ", b = " << b << endl;
cout << "a + b = " << a + b << endl;
cout << "a * b = " << a * b << endl;
cout << " the real part of a is " << real(a) << endl;
cout << "the imaginary part of b is " << imag(b) << endl;
cout << "the magnitude of a is " << abs(a) << endl;
cout << " e^a = " << exp(a) << endl;
cout << "ln(b) = " << log(b) << endl;
return 0;
}
这是不能找到原文件,不知道楼主有没有将这个文件添加进来
整个电脑都搜了……没有这个文件:(是不是还要分外下载相应的库啊?
一周热门 更多>