二级二级C++2004年9月全国计算机等级考试二级笔试试卷&公共基础知识及C++语言程序设计
题目内容

有以下程序#include <iostream>using namespace std;class Complex{public:Complex(double r =0, double i =0):re(r), im(i) { }double real() const { return re; }double imag() const { return im;}Complex operator +(Complex c) const{ return Complex(re+c.re, im+c.im); }private:double re, im;};int main(){Complex a = Complex(l, 1) + Complex(5);cout <<

2024-07-09

A.real() << '+' << a.imag() <<'i' << endl;return 0;}程序执行后的输出结果是A.6+6i

B.6+1i

C.1+6i

D.1+1i

题目答案

试卷相关题目

最新试卷
热门试卷

长理培训客户端 资讯,试题,视频一手掌握

去 App Store 免费下载 iOS 客户端