题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-02 03:34:17

[填空题]下列程序的输出结果是 【14】
#include <iostream>
using namespace std;
template <typename T>
T total (T *data) T s = 0;
while(*data)

s+=*data++;

return s;
int main( ) int x[]=2,4,6,8,0,12,14,16,18;
cout<<total(x)<<end1;
return 0;

更多"下列程序的输出结果是 【14】 。#include <iostream"的相关试题:

[单项选择]下列程序的输出结果是
#include"iostream"
using namespace std;
int Max(int a,int b)

if(a>b)
return a;
else
return b;

void main( )

int m,n;
m=10,n=5;
int max = Max(m,n);
cout<<max<<endl;

A. 10
B. 程序有误
C. 1
D. 0
[单项选择]以下程序执行后的输出结果是 #include<iostream>. using namespace std; void try(int,int,int,int); int main( ) { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A. 18
B. 9
C. 10
D. 不确定
[填空题]下列程序的输出结果是 【14】
#include <iostream>
using namespace std;
template <typename T>
T total (T *data) T s = 0;
while(*data)

s+=*data++;

return s;
int main( ) int x[]=2,4,6,8,0,12,14,16,18;
cout<<total(x)<<end1;
return 0;

[填空题]下列程序的输出结果是 【15】
#include <iostream>
using namespace std;
template <typename T>
T total(T* data) Ts=0;
while(*data)

s+=*data++;

return s;int main( ) int x[]=2,4,6,8,0,12,14,16,18;
cout<<total(x)<<end1;
return 0;

[填空题]下列程序的输出结果是 【13】
#include <iostream>
using namespace std;
int main( ) int data=1;
int &r = data;
data+=5;
r+=5;
cout<<data<<end1;
return 0;

[单项选择]执行如下程序将输出( ): #include<iostream> using namespace std; class Base { public: Base( ){cout<<"BB";fun( );} void fun ( ){tout<<"Brim";} }; class Derived:public Base { public: Derived( ){cout<<"DD";} void fun ( ){cout<<"Dfun";} }; int main( ){Derived d;return 0;}
A. DD
B. BBDfunDDDfun
C. BBBfunDD
D. DDBBBfun
[填空题]以下程序的输出是 【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; class Amount{ int amount; public: Amount(int n=0):amount(n){} int getAmount( )const{return amount;} Amount&operator9=(Amount a){ amount+=a. amount; return______; } }; int main( ){ Amount x(3),y(7); x+=y, cout<<x. getAmount( )<<endl; return 0; } 已知程序的运行结果是10,则下划线处缺失的表达式是
A. * this
B. this
C. &amount
D. amount
[单项选择]下面程序的执行结果为
#include"iostream"
using namespace std;
class A

int a;
public:
void Seta(int x)a=x;
void Display_a( )cout<<a<<endl;

class B

int b;
public:
void Setb(int x)b=x;
void Dispaly-b( ) cout<<b<<endl;

class C://public A,private B

private:
int c;
public:
void Setc(int x,int y,int z)
c=z;Seta(x);Setb(y);
void Display_c( ) cout<<c<<endl;

①void main( )

③ C cc;
④ cc.Seta(1);
⑤ cc.Display_a( );
⑥ cc.Setc(2,2,3);
⑦ cc.Dispaly-b( );
⑧ cc.Display_c( );

A. 输出为2 2 3
B. 有错误在第5行
C. 输出为1 2 3
D. 有错误在第7行
[填空题]下列程序的输出结果是__________ #include using namespace std; class A{ int a public: A( ):a(9){} virtual void print( ) const {cout<print( ); show(d1); show(d2); return 0;}
[填空题]下列程序输出结果是 【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;
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;
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. 语法错误,不能输出结果

我来回答:

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

订单号:

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