题目内容
(以下试题六至试题八任选一题)阅读下列说明和C++代码,请回答问题1至问题3。【说明】已知下列程序运行时的输出应为:1:11:11:1【C++程序】01 #include <iostream>02 using namespace std;03 class Stock{04 protect:05 (1) {};06 Stock(iht n, int pr=1){07 shares = n; share_val=pr;08 };09 void~Stock(){};10 public:11 //成员函数12 void output(){13 (2) << shares << ":" << share val << endl;14 }15 private:16 //成员变量17 int shares;18 int share_val;19 };2021 void main(){22 Stock a(1); a.output();23 Stock b; b.output();24 Stock c = Stock(); c.output();25 } 【问题1】 请补齐下述代码中的空缺1和2。
查看答案
搜索结果不匹配?点我反馈
更多问题