有以下程序
#include
...
发布于 2022-03-03 11:37:09
有以下程序
#include<iostream> using namespace std class complex { int real int imag public: complex(int r = 0, int i = 0) { real = r imag = i } _________________________________ } void add(complex& a, complex& b) { int r = a.real + b.real int i = a.imag + b.imag cout << r << "+" << i << "i" << endl } int main() { complex x(1, 2), y(3, 4), z add(x, y) }
登录后免费查看答案
关注者
0
被浏览
18