题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-01-15 19:46:15

[填空题]请将下列栈类Stack补充完整。 class Stack{ private: int pList[100]; //int数组,用于存储占的元素 int top; //栈顶元素(数组下标) public: Stack( ):top(0){ } void Push(const int&item); //新元素item压入栈 int Pop(void); //将栈顶元素弹出栈 }; void Stack::Push(const int&item){ if(top==99) exit(1); //如果栈满,则程序终止 top++; //栈顶指针增1 ______; } int Stack::Pop( ){ if(top<0) exit(1); //如果栈空,则程序终止 return Plist[top--]; }

更多"请将下列栈类Stack补充完整。 class Stack{ "的相关试题:

[填空题]请将下列栈类Stack补充完整 class Stack{ private: int pList[100]; //int数组,用于存放栈的元素 int top; //栈顶元素(数组下标) public: Stack( ):top(0){} void Push(const int &item);//新元素item压入栈 int Pop(void); //将栈顶元素弹出栈 }; void Stack::Push(const int &item){ if(top==99) //如果栈满,程序终止 exit(1); top++; //栈顶指针增1 【15】 ; } int Stack::Pop( ){ if(top<0) //如果栈空,程序终止 exit(1); return pList[top--]; }
[填空题]请将下列栈类Stack补充完整。
class Stack
private:
intpList[100]//int数组,用于存放栈的元素
inttop;//栈顶元素(数组下标)
public:
Stack( );top(0)
void Push(const int &item);//新元素item压入栈
int Pop(void); //将栈顶元素弹出栈

void Stack::Push(const int&item)
if(top==99) //如果栈满,程序终止
exit(1)
top++; //栈顶指针增1
______;

int Stack::Pop( )
if(top(0) 如果栈空,程序终止
exit(1);
return pList[top--];

[填空题]请将下列栈类Stack补充完整。
class Stack
private:
int pList[100]; //int数组,用于存储占的元素
int top; //栈顶元素(数组下标)
public:
Stack( ):top(0)
void Push(const int&item); //新元素item压入栈
int Pop(void); //将栈顶元素弹出栈

void Stack::Push(const int&item)
if(top==99) exit(1); //如果栈满,则程序终止
top++; //栈顶指针增1
______;

int Stack::Pop( )
if(top<0) exit(1); //如果栈空,则程序终止
return Plist[top--];

[填空题]请将下列栈类Stack的横线处补充完整。
class Stack
private:
int pList[100]; ∥int数组,用于存放栈的元素
int top; ∥栈顶元素(数组下标)
public:
Stack( ):top(0)
void Push(const int &item); ∥新元素item压入栈
int Pop(void); ∥将栈顶元素弹出栈
;
void Stack∷Push(const int &item)
if(top==99) ∥如果栈满,程序终止
exit(1);
top++; ∥栈顶指针增1
______;

int Stack∷Pop( )
if(top<0) ∥如果栈空,程序终止
exit(1);
return pList[top--];

[填空题]

请将下面程序补充完整。
public class PowerCalc{
public static void main(String[]args){
double x=5.0;
System. out. println(x+"to the power 4 is"+power(x, 4));
System. out. println("7. 5 to the power 5 is"+power(7.5, 5));
System. out. println("7.5 to the power 0 is"+power(7.5, 0));
System. out. println("10 to the power -2 is"+power(10, -2));
}
static double 【11】 (double x, int n){
if(n>1)
return x * power(x, n-1);
else if(n<0)
return 1.0/power(x, -n);
else
return n==0 1.0:x;
}
}


[填空题]类Sampie的构造函数将形参data赋值给数据成员data。请将类定义补充完整。
class Sample
public:
Sample(int data=0);
priVate:
int data:

Sample::Sample(int datA)
______

[填空题]

类Sample的构造函数将形参data赋值给数据成员data。请将类定义补充完整。
  class Sample{
  public:
  Sample(int data=0);
  Private:
  Int data;
  };
  Sample::Sample(int data){
   【10】
  }


[填空题]请将程序补充完整。 import java.awt.*; public class FirstFrame extends Frame { public static void main(String args[]){ FirstFrame fr=new FirstFrame("First container!"); fr.setSize(240,240); fr. setBackground(Color.yellow); 【15】 } public FirstFrame(String str){ super(str); } }
[填空题]请将程序补充完整。
import java.awt.*;
public class FirstFrame extends Frame
public static void main(String args[])
FirstFrame fr=new FirstFrame("First container!");
fr.setSize(240,240);
fr.setBackground(Color.yellow);
【15】

public FirstFrame(Strings str)
super[str);

)
[填空题]请将程序补充完整。
import java.awt.*;
public class FirstFrame extends Frame
public static void main(String args[])
FirstFrame fr = new FirstFrame("First container!");
fr. setSize(240,240);
fr. setB ackground(Color, yellow);
【15】

public FirstFrame(String str)
super(str);


[填空题]

请将下列模板类Data补充完整。
  template
  class Data{
  public:
  void put (T v) { val=v; }
   【15】 get( ) //返回数据成员val的值,返回类型不加转换
  { return val; }
  private:
  T val;
  };


[填空题]请将下列类定义补充完整 class Base{public: void fun( ){cout<<"Base::fun"<<end1;}}; class Derived:public Base { public: void fun( ){ ______//显式调用基类的fun函数 cout<<"Derived::fun"<<end1; } };
[填空题]请将下列类定义补充完整。
class Basepublic:void fun( )cout<<"Base∷fun"<<end1;;
c1ass DehVed:public Base

public:
void fun( )
______ ∥显式调用基类的fun函数
cout<<"Derived∷fun"<<endl;

;
[填空题]请将下列模板类Data补充完整。
template <typename T>
class Data
public:
void put(T v)val=v;
______get( )return val; //返回数据成员val的值,返回类型不加转换
private:
T val;

[填空题]下列程序的输出结果为2,请将程序补充完整。
using namespace std;
class Base
public:
【12】 void fun( ) cout<<1;
;
class Derived:public Base

public:
void fun( ) cout<<2;
int main( )

Base*p=new Derived;
p->fun( );
delete p;
return 0’;

我来回答:

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

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码