如何使用stl中的complex类

webrolling 2004-01-12 08:02:25
写一下对象的声明和一些基本的运算就行了
谢谢了
...全文
139 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lifanxi 2004-01-12
  • 打赏
  • 举报
回复
要包上complex头文件,另外,因为complex是一个模版,所以使用时要指定它的实际数据类型。
#include <iostream>
#include <complex>
using namespace std;

int main()
{
complex<int> i(6, 9);
complex<int> j(3, 3);
complex<int> k = i + j;
cout << k << endl;
}
ntxs 2004-01-12
  • 打赏
  • 举报
回复
#include <complex>

24,860

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧