题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-07-22 03:16:29

[单项选择]如下程序运行时的输出结果是
#include<iostream>
using namespace std;
class ONE
int c;
public:
ONE( ):c(0)eout<<1;
ONE(int n):C(n)cout<<2;

class TW0
ONE onel;
ONE one2;
public:
TWO(int m):one2(m)eout<<3;

int main( )
TWO t(4);
return 0;

A. 3
B. 23
C. 123
D. 213

更多"如下程序运行时的输出结果是 #include<iostream> "的相关试题:

[单项选择]如下程序运行时的输出结果是
#include<iostream>
using namespace std;
class ONE
int c;
public:
ONE( ):c(0)eout<<1;
ONE(int n):C(n)cout<<2;

class TW0
ONE onel;
ONE one2;
public:
TWO(int m):one2(m)eout<<3;

int main( )
TWO t(4);
return 0;

A. 3
B. 23
C. 123
D. 213
[单项选择]下面的程序输出结果是( )。
#include<iostream>
using namespace std;
void add( )

static int x;
x++;
cout<<x<<’’;

int main( )

for(int i=0;i<3;i++)
add( );
return 0;

A. 111
B. 123
C. 222
D. 333
[单项选择]下面程序的执行结果是( )。
#include<iostream>
using namespace std;
class building
public:
building( )
building(unsigned stories, float breadths, float lengths)
story = stories; breadth = breadths; length = lengths;
void getstory(void)
cout<<"story is:"<<story<<endl;
void getarea(void)
area = length*breadth*story;cout<<"area is:"<<area<<endl;
private:
unsigned story;
float length;
float breadth;
float area;
;
void main(void)

building b1,b2;building b3(10u,16.6,58.8);
b1.getstory( );
b1.getarea( );
b2.getstory( );
b2.getarea( );
b3.getstory( );
b3.getarea( );

A. story is:0
B. story is:null
C. 前两个对象输出的结果是不定的,后一个对象的结果正确
D. 前两个对象没有初值,因此程序编译时出错
[单项选择]下面程序的输出结果是( )。
#include<iostream>
Using namespace std:
Class Base
public:
Base(int x=0)count<<x;


Class Derived:public Base
public:Derved(int x=0count<<x;

private:
Base val;

int mina( )
Derived d(1);
return 0;

A. 0
B. 1
C. 01
D. 001
[单项选择]下面程序运行的结果是( )。 #include<iostream> using namespace std; class A{ protected: int a; public: void input(int i) {a=i;} }; class B{ protected: int a; public: void input(int j) {a=j;} }; class C: public A, public B { int x; public: void input( ) {x=A::a * B::a;cout<<x<<endl;} }; void main( ) { C c; c.A::input(5); c.B::input(8); c.input( ); }
A. 5
B. 8
C. 40
D. 编译出错
[单项选择]下面程序的运算结果是( )。 #include<iostream> using namespace std; class A { public: virtual void fun( )=0; }; class B:public A } public: void fun( ) {cout<<"new file"<<" ";} }; class C:public A { public: void fun( ) { cout<<"open file"<<" ";} }; void main( ) { A a, * p; B b;C c; p=&c; p->fun( ); p=&b; }
A. new file open file
B. new file new file
C. 编译出错
D. open file new file
[填空题]下列程序的输出结果是 【8】 #include<iostream> using namespace std; int &qetVar(int *pint) { renurn *pint; } int main ( ) { int a =10; getVar(&a) = 20; cout<<a<<end1; return 0; }
[单项选择]下面程序输出的结果是( )。
#include<iostream>
using namespace std;
int fuc (char *x);
int main( )
cout<<fuc("hello")<<endl;
return 0;

int fuc(char *x)
char *y=x;
while(*y! =’/0’)y++;
return(y-x);

A. 5
B. 6
C. 0
D. 语法错误,不能输出结果
[单项选择]下面程序的输出结果是( )。
#include<iostream>
using namespace std;
int main( )

int a=2,b= -1,c=2;
if(a<b)
if(b<0)
c=0;
else c+=1;
cout<<c<<endl;
return 0;

A. 0
B. 1
C. 2
D. 3
[单项选择]下列程序的输出结果是( )。
#include<iostream>
using namespace std;
class TestClass
static int i;
public:
TestClass( )i++;
~TestClass( )i--;
static int getVal( )return i;

int TestClass::i=O;
void fun( )TestClass ob2;cout<<ob2.getVal( );
int main( )
TestClass ob1;
fun( );
TestClass*ob3=new TestClass;cout<<ob3->getVal( );
delete ob3;cout<<TestClass::getVal( );
return 0;

A. 111
B. 121
C. 211
D. 221

我来回答:

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

订单号:

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