题海让大学四年没有难题
白天模式登陆

题目详情

单选题 The output result after executing the following program is ( )#include <iostream>using namespace std;class complex {private: double re, im;public: complex (double r, double i) : re(r), im(i) { } double real ( ) const { return re; } double image ( ) const { return im; } complex &operator += (complex a) { re += a.re; im += a.im; return *this; }};void disp(const complex &z) { cout << "(" << z.real( ) << ", " << z.image( ) << ")";}int main ( ) { complex x(1, -2), y(2, 3); disp(x+=y); return 0;}

A. (1, -2)

B. (2, 3)

C. (3, 5)

D. (3, 1)

C++语言程序设计课程封面

学科:C++语言程序设计

时间:2025-12-18 02:35:52

Copyright © 2022 津ICP备2021001502号