题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-12-20 23:54:56

[填空题]请将下列栈类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{ pr"的相关试题:

[填空题]请将下列栈类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--]; }
[填空题]请将下列栈类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;
}
}


[填空题]下列的Java语句是把字符串“12345”转换为int型数据,请补充完整。    int x;    x= 【 】 ;
[填空题]下列的Java语句是把字符串“12345”转换为int型数据,请补充完整。
   int x;
   x= 【11】

[填空题]

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


[单项选择]能将程序补充完整的选项是
class Person

private int a;
public int change(int m)return m;

public class Teacher extends Person

public int b;
public static void main(String arg[])

Person p=new Person( );
Teacher t=new Teacher( );
int i;
______


A. i=m
B. i=b
C. i=p.a
D. i=p.change(50)
[单项选择]能将程序补充完整的选项是( )。
class Person

private int a;
public int change(int m)return m;

public class Teacher extends Person

public int b;
public static void main(String arg[])

Person P=new Person( );
Teacher t=new Teacher( );
int i;
________


A. i=m
B. i=b
C. i=P.a
D. i=P.change(50)
[填空题]函数fun的功能是将一个数字字符串转换为一个整数,请将函数补充完整。
int fun(char *str)
int num=0;
while(*str)
num*=10;
num+=______;
str++;

return num;

[填空题]函数fun的功能是将一个数字字符串转换为一个整数,请将函数补充完整。
int fun(char*str)
int hum=0;
while(*str)
num*=10;
num+=______
str++;

return num;

[填空题]请将程序补充完整。 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);

public FirstFrame(String str)
super(str);


我来回答:

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

订单号:

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