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

[单项选择]执行以下程序后的输出结果为( )。
#include<iostream. b>
class Sample int x, y;
public:
Sample( ) x=y=0;
Sample(int a, int b) x=a; y=b;
void disp ( )

cout<<"x="<<x<<"y="<<y<<end1;

;
void main( ) Sample s(2,3), *p=&s;
p->disp( );

A. x=1, y=3
B. x=2, y=4
C. x=3, y=2
D. x=2, y=3

更多"执行以下程序后的输出结果为( )。#include<iostream"的相关试题:

[单项选择]执行以下程序后的输出结果为( )。#include<iostream. b>class Sample{ int x, y; public: Sample( ) { x=y=0;} Sample(int a, int b) {x=a; y=b; } void disp ( ) { cout<<"x="<<x<<"y="<<y<<end1; }};void main( ){ Sample s(2,3), *p=&s; p->disp( );}
A. x=1, y=3
B. x=2, y=4
C. x=3, y=2
D. x=2, y=3
[单项选择]以下程序的执行结果为( )。
#include<iostream.h>
class Sample

int n;
public:
Sample(int i)n=i;
operator++( )n++; //前缀重载运算符
operator++(int)n+=2; //后缀重载运算符
void disp( )

cout<<"n="<<n<<end1;

;
void main( )

Sample A(2),B(2);
A++;
++B;
A.disp( );
B.disp( );

A. n=4
B. n=1
C. n=3
D. n=5
[单项选择]以下程序的执行结果为( )。 #include<iostream.h> Class sample { int n; public: sample(int i){n=i; } operator ++( ) { n++; } void display( ) {cout<<n<<end1; } }; void main( ) { sample obj(5); obj++; obj.display( ); }
A. 5
B. 6
C. 7
D. 8
[单项选择]下列程序的执行结果是( )。
#include<iostream.h>
class Sample

int x,y;
public:
Sample( )x=y=0;)
Sample(int a,int b)x=a;y=b;
~Sample( )

if=(x==y)
cout<<“x=y”<<endl;
else
cout<<“x!=y”<<endl;

void disp( )

cout<<“x=”<<x<<“,y=”<<y<<endl;

;
void main( )

Sample s1(2,3);
s1.disp( );

A. x=2,y=2
B. x=3,y=3
C. x=2,y=3
D. x=3,y=2
[单项选择]以下程序执行后的输出结果是 ( )。 #include <iostream.h> class Basel { public: void fun( ){ cout<<"Basel"<<end1; } }; class Base2 { public: void fun( ) { cout<<"Base2"<<end1; } } class Derived : public Basel,public Base2 { }; void main( ) { Derived Obj; Obj.fun( ); }
A. Basel
B. Base2
C. BaselBase2
D. 程序产生二义性
[单项选择]执行以下程序后的输出结果为 ( )。
#include<iostream>
Using namespace std;
void fun(int x, int y, int *cp, int *dp)
*cp=x+ y; 2*dp=x- y;
void maia( )

int a, b, c, d;
a=30; b=50;
fun(a, b, &c, &d);
cout<<c<<’,’<,d<<end1;

A. 50, 30
B. 30, 50
C. 80, 20
D. 80, 20
[填空题]执行以下程序后的输出结果是【 】。 main( ) {int a=10; a=(3*5,a+4);printf("a=%d\n",a); }
[填空题]执行以下程序后,输出结果第二行的内容是______。
#include<iostream>
using namespace std;
class TestClass

public:
virtual void who( )cout<<"Base Class"<<endl;
;
class TestClass1:public TestClass

public:
virtual void who( )cout<<"TestClass1 Class"<<endl;
;
class TestClass2:public TestClass

public:
virtual void who( )cout<<"TestClass2 Class"<<endl;
;
int main(int argc,char*argv[])

TestClass obj1,*p;
TestClass1 obj2;
TestClass2 obj3;
P=&obj1;p->who( );
p=&obj2;p->who( );
p=&obj3;p->who( );
return 0:

[填空题]执行以下程序后的输出结果是 【6】
main( )
int a=10;
a=(3*5,a+4); printf("a=%d/n",a);

[单项选择]下列程序的输出结果是
#include
class Myclass
public:Myclass(int i=0,intj=0)
x=i;
y=j;

void show( ) cout < < "x=" < < x < < " " < "y=" < < y < < end1;
void show( )const cout < < "x=" < < " " < < "y=’ < < y < < end1;
privated:
int x; int y;

void main( )
Myclass my1(3,4);
const my2(7,8);
my1.show( );my2.show( );
A. x=4,y=3;x=7,y=8
B. x=3,y=4;x=7,y=8
C. x=7,y=8;x=4,y=3
D. x=8,y=7;x=7,y=8
[填空题]执行以下程序后的输出结果是______。 main( ) {inta=10; a=(3*5,a+4);printf("a=%d/n",a); }

我来回答:

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

订单号:

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