题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-09-15 23:45:57

[单项选择]有如下程序: #include<iostream> using namespace std; class Stack{ public: Stack(unsignedn=10):size(n){rep_=new int[size];top=0;} Stack(Stack& s):size(s.size){ rep_=new int[size]; fbr(inti=0;i<size;i++)rep_[i]=s.rep_[i]; top=s.top; } ~Stack( ){delete[ ]rep_;} void push(int A) {rep一_top]=a;top++;} int pop( ){--top;return rep_[top];} b001 isEmpty( )const{return top==0;} private: int * rep_; unsigned size,top; }; int main( ){ Stack sl; for(int i=1;i<5;i++)s1.push(i); Stack s2(s1); for(i=1;i<3;i++)cout<-<s2.pop( )<<’,’; s2.pusl:(6); s1.push(7); while(!s2.isEmpty( ))cout<<s2.pop( )<<’,’; return 0: } 程序的输出结果是
A. 4,3,2,1,
B. 4,3,6,7,2,1,
C. 4,3,6,2,1,
D. 1,2,3,4,

更多"有如下程序: #include<iostream> using n"的相关试题:

[填空题]有如下程序:
#include <iostream>
using namespace std;
class Con
char ID;
public:
Con( ):ID(’A’)cout<<1;
Con(char ID) :ID(ID) eout<<2;
Con(Con&C) :ID(C.getID( ))cout<<3;
char getID( )constreturn ID;

void show(Con e)cout<<e.getID( );
int main( )
Con cl;
show(c1);
Con c2(’B’);
show(c2);
return 0;

程序的输出结果是______。

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码