题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-12-31 21:40:18

[单项选择]下列程序中划线处正确的语句是( )。
#include <iostream>
using namespace std;
class Basepublic:
void fun( ) cout<<"Base:: fun"<<end1;
;
class Derived: public Base void fun( )

_______________________ //显试调用基类的函数 fun( )
cout <<"Derived:: fun"<<end1;
;
A. fun();
B. Base. fun();
C. Base:: fun();
D. Base->fun();

更多"下列程序中划线处正确的语句是( )。#include <iostre"的相关试题:

[单项选择]下列程序中划线处正确的语句是( )。
#include <iostream>
using namespace std;
class Basepublic:
void fun( ) cout<<"Base:: fun"<<end1;
;
class Derived: public Base void fun( )

_______________________ //显试调用基类的函数 fun( )
cout <<"Derived:: fun"<<end1;
;
A. fun();
B. Base. fun();
C. Base:: fun();
D. Base->fun();
[填空题]下列程序输出结果是 【13】
include <iostream>
using namespace std;
template <typename T>
T fun(T a, T b) return (a<=b)a:b;
int main( )

cout<<fun(3,6)<<’,’<<fim(3.14F, 6.28F)<<end 1;
return 0;

[单项选择]下面程序的运行结果是( )。 #include <iostream> using namespace std; template <class T> class A{ T x,y; public: A(T a,T b){x=a;y=b;} int add( ){return x+y;} }; void main( ){ A<double>a(7.8,3.4); A<char>b(7.8,3.4); cout<<a.add( )<<","<<b.add( ); }
A. 10,10
B. 11,11
C. 11,10
D. 以上答案都不对
[填空题]下面程序的运行结果是 【8】
#include <iostream>
using namespace std;
int fun(int n)

static int m = 2;
m=m+n;
return m;

int main ( )

int a = 3, b = 4;
int x;
x = fun( a );
x = fun( b );
cout<<x<<end1;
return O;

[单项选择]下列程序的运行结果为( )。
#include <iostream>
using namespace std;
namespace m
int flag = 10;

namespace n
flag = 100;

void mian( )
int flag = 0;
using namespace n;
cout<<flag<<","<<m:: flag;

A. 100,10
B. 100,0
C. 0,100
D. 0,10
[填空题]以下程序的输出是 【8】 。 #include<iostream> using namespace std; fun(intm) { static int n=1; n=m*n; return(n); } void main( ) { int i; for(i=1;i<=3;i++) cout<<fun(i); }
[单项选择]以下程序的输出结果是( )。 #include <iostream> using namespace std; int main( ){ int a=1,b; switch(a){ case 1:b=30; case 2:b=20; case 3:b=10; default:b=0; } cout<<b<<endl; return 0; }
A. 30
B. 20
C. 10
D. 0
[单项选择]下面程序的运行结果为( )。
#include <iostream>
using namespace std;
class A
public:
A( )cout<<" ";
~A( )cout<<" ";

class B:public A
public:
B( )cout<<" ";
~B( )cout<<" ";

void main( )
B b;

A. 1234
B. 1324
C. 1342
D. 3142
[填空题]下面程序执行的结果是 【14】
#include<iostream>
using namespace std;
class A
public:
static int x;
A(inty)cout<<x+y;

int A::x=2;
void main( )
A a(5);

[单项选择]下面程序输出的结果是( )。
#include <iostream>
using namespace std;
void swap(int &a,int &b)
int temp;
temp=a;
a=b;
b=temp;

void main( )
int x=2;
int y=3;
swap(x,y);
cout<<x<<y;

A. 23
B. 32
C. ab
D. ba
[单项选择]以下程序段共有错误( )处。 #include <iostream> using namespaces std; class Sample { private: int n; public: Sample(int i) { n=i; } void setvalue (int i) { n=i; } void display( ) { cout<<”n=”<<n<<endl; } }; int main( ) { const Sample a(10); a.setvalue(5); a.display( ); return 0; }
A. 1
B. 2
C. 3
D. 4
[单项选择]下面程序的输出结果是( )。
#include <iostream>
using namespace std;
void main( )
int i,j,m=0,n=0;
for(i=0;i<2;i++)
for(j=0;j<2;j++)
if(j> =i) m=1;n++;
cout<<m<<endl;
cout<<n;
A. 1
B. 1
C. 1
D. 0

我来回答:

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

订单号:

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