题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-12-13 04:51:09

[填空题]

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


更多"请将下列模板类Data补充完整。   template   clas"的相关试题:

[填空题]下列程序将x、y和z按从小到大的顺序排列,请将下面的函数模板补充完整。 template<class T>
void order( 【13】 )

T a;
if(>y)

a=X; x=y;y=a;

if (y>z)

a=y: y=Z:Z=a:

if(x>y)

a=X; x=y;y=a;


[填空题]

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


[填空题]下列程序的功能是创建了一个实现5个“Hello!”的线程并启动运行,请将程序补充完整。
public class Test extends Thread
public static void main(String[ ] args)
Test t = new 【10】 ;
t. start( );
public void run( )
int i = 0;
while (true)
System. out. println( "Hello" );
if (i++ ==4) break;


[填空题]下列程序的功能是创建了一个显示5个"Hello!"的线程并启动运行,请将程序补充完整。
public class ThreadTest extends Thread
public static void main(String args[])
ThreadTest t=new 【12】
t.start( );

public void run( )
int i=0;
while(true)
System.out.println("Hello!");
if(i++==4) break;



[填空题]补充完整下面的模板定义: template<class Type> //Type为类型参数 class Xtwo{ //由两个Type类型的数据成员构成的模板类 Type a; Type b; public: Xtwo(Type aa=0,Type bb=0):a(aA) ,b(bB) { } int Compare( ){ //比较a和b的大小 if(a>B) return 1; else if(a==B) return 0; else return-1; } Type Sum( ){return a+b;} //返回a和b之和 Type Mult( ); //函数声明,返回a和b之乘积 }; template<class Type> ______ ::Mult( ){return a*b;} //Mult函数的类外定义
[填空题]

补充完整下面的模板定义:
template<class Type> //Type为类型参数
class Xtwo{ //由两个Type类型的数据成员构成的模板类
Type a;
Type b;
public:
Xtwo(Type aa=0,Type bb=0):a(aa),b(bb){}
int Compare( ){ //比较a和b的大小)
if(a>b) return 1;
else if(a= =b) return 0;
else return -1;
}
Type Sum( ){return a+b;)//返回a和b之和
Type Mult( ); //函数声明,返回a和b之乘积
};
template<class Type>
______::Mult( ){ return a*b;}//Mult函数的类外定义


[填空题]请按下面注释的提示,将类B的构造函数定义补充完整。
classA

int a;
public:
A(int aa=0) a=aa;)

Class B:public A

int b;
A c;
public:
//用aa初始化基数A,用aa+1初始化类对象成员c
B(int aa): (b=aa+2)

[填空题]请将程序补充完整。
importjava.awt.*;
publicclassFirstFrameextendsFrame
publicstaticvoidmain(Stringargs[])
FirstFramefr=newFirstFrame("Firstcontainer!");
fi.setSize(240,240);
fi.setBackground(Color.yellow);

publicFirstFrame(StringStr)
super(Str);


[填空题]

请将下面程序补充完整。
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;
}
}


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


我来回答:

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

订单号:

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