填空题

下列程序的输出结果是 【10】 。
#include <iostream>
using namespace std;
int main()

int data=1;
int &r = data;
data+=5;
r+=5;
cout<<data<<end 1;
return 0;

【参考答案】

K
<上一题 目录 下一题>
热门 试题

填空题
在下面横线上填上适当的语句,完成程序。 #include <iostream> using namespace std; class Base int x; public: Base(int i) x=i; ~Base() ; class Derived: public Base public: ______∥完成类 Derive构造函数的定义 ; int main() Derived Obj; return 0; 在横线处应填入的语句是 【9】 。
单项选择题
有以下程序: class Date public: Date(int y, int m, int d); year = y; month = m; day = d; Date(int y = 2000) year = y; month = 10; day = 1; Date(Date &d) year = d.year; month = d.month; day = a.day; void print() cout<<year<< . <<month<< . <<day<<end1; private: int year, month,day; ; Date fun(Date d) Date temp; temp = d; return temp; int main() Date date 1 (2000,1,1),date2(0,0,0); Date date3(date 1); date2 = fun(date3); return 0; 程序执行时,Date 类的拷贝构造函数被调用的次数是
A.2
B.3
C.4
D.5
相关试题
  • 有如下程序: #include <iostream> u...
  • 已知 int DBL(int n)return n+n;和...
  • 有以下程序 #include <iostream> usi...
  • 有以下程序 #include <iostream> usi...
  • 有以下程序: #include <iostream> u...