题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-08 22:43:51

[填空题]main函数中发生编译错误的语句是 【12】
# include <iostream. h>
class A

public:
int a;
const int b:
A( ) :a(10) ,b(20)
void fun( ) const

cout<<"a="<<a<<"/tb="<<b<<end1;

;
void main( )
A obj1;
const A * ptr = new A:
ptr = &obj1;
ptr->a=lO0;
ptr->fun( ),

更多"main函数中发生编译错误的语句是 【12】 。 # in"的相关试题:

[填空题]main函数中发生编译错误的语句是______。
#include<iostream.h>
class A

public:
int a;
const int b;
A( ):a(10),b(20)
void fun( )const

cout<<"a="<<a<<"/tb="<<b<<endl;

;
void main( )

A obj1;
const A*ptr=new A;
ptr=&obj1;
ptr->a=100;
ptr->fun( );

[填空题]参照函数模板的写法,完成非模板函数的定义,语句为______。
#include<iostream.h>
#include<string.h>
template<class T>
T min(T a,T b)

return(a<b a:b);

char*min(char *a,char *b)


void main( )

double a=1.23,b=3.45;
char s1[]="abcd",s2[]="efg";
eout<<min(a,b)<<min(s1,s2)<<endl;

[填空题]完成下列类的构造函数,初始化语句为 【13】 。 #include <iostream. h> class Test { private: int x, y; public, void Test(int initx, int inity){ ______ } void printx( ) {cout<<x<<"—"<<y<<"="<<x-y;} }; void main( ) { Test x(300, 200); x. printx( ); }
[填空题]完成下列类的构造函数,初始化语句为 【13】
#include <iostream. h>
class Testprivate:
int x, y;
public,
void Test(int initx, int inity)
______ void printx( ) cout<<x<<"—"<<y<<"="<<x-y;

void main( ) Test x(300, 200);
x. printx( );
[填空题]完成下列类的构造函数,初始化语句为______。 #include<iostream.h> class Test { private: int x,y; public: void Test(int initx,int inity){ ______ } void printx( ){cout<<x<<"-"<<y<<"="<<x-y;} }; void main( ) { Test x(300,200); x.printx( ); }
[填空题]完成下列类的构造函数,初始化语句为______。
#include<iostream.h>
class Test

private:
int x,y;
public:
void Test(int initx,int inity)
______

void printx( )cout<<x<<"-"<<y<<"="<<x-y;
;
void main( )

Test x(300,200);
x.printx( );

[单项选择]下面程序有注释的语句中,错误的语句是( )。
#include <iostream>
using namespace std;
class A
int a;
public:
void show A( )cout<<"this is A!";

class B:public A
int b;
public:
void show B( )cout<< "this is B!";

void main( )
A ia,*piA;
B ib,*piB;
piA=ia; //第一个测试语句
piA=&ib; //第二个测试语句
piA->showA( ); //第三个测试语句
piA->showB( ); //第四个测试语句

A. 第一个测试语句
B. 第二个测试语句
C. 第三个测试语句
D. 第四个测试语句
[简答题]完成下面类中成员函数的定义。
#include<iostream>
#include<string>
using namespace std;
class str
private:
char*st;
public:
str(char*a)
set(a);
str&operator=(______)
delete st;
set(a.st);
return*this;

void show( )cout<<st<<endl;
~str( )delete st;
void set(char*s)//初始化st
______
strcpy(st,s);


void main( )
str s1("he"),s2("she");
s1.show( ),s2.show( );
s2=s1;
s1.show( ),s2.show( );

[判断题]C程序总是从main( ) 函数的第一条语句开始执行的。 ( )
[简答题]完成下面类中成员函数的定义。
#include<iostream.h>
#include<iomanip.h>
class Arr
protected:
float*p;
int n;//数组大小(元素个数)
public:
Arr(int sz=10)
n=sz;
p=new float[n];

~Arr(void)
______
int Getn(void)const

return n;

float*operator[](int i)
______
void Print( );

void Arr::Print( )
int i;
for(i=0;i<this->Getn( );i++)
if(i%10= =0)
cout<<endl;
cout<<setw(6)<<p[i];

cout<<endl:

void main( )
Arr a(20);
for(int i=0;i<a.Getn( );i++)
a[i]=i*2;
a.Print( );

[填空题]程序   #include" iostream.h"   void main( )   {    int i=10;    jnt j=5;    cout < < j+i++ < < end1;   }  的结果为 【7】 

我来回答:

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

订单号:

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