题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-05-14 02:19:51

[填空题]下列程序运行时的输出结果是___【8】___。 #include<iostream> using namespace std; int Xfun(int*a, int n); int main( ) int b[6]={-2, 6, 8, -3, 5, 4); cout<<Xfun(b, 6)<<end1; return 0; } int Xfun(int*a, int n){ int x=0; for(int*p=a; p<a+n; p++)if(*p>0)x+=*p; return X; }

更多"下列程序运行时的输出结果是___【8】___。 #include<i"的相关试题:

[单项选择]如下程序运行时的输出结果是 #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;
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
[填空题]下列程序运行时的输出结果是__【9】____。 #include<iostream> using namespace std; void Xfun(int&, int&); int main( ){ int a=3, b=4; Xfun(a, B) ; cout<<a*a+b<<end1; return 0; } void Xfun(int& x, int& y){ int z=x; x=y; y=z; }
[单项选择]如下程序的输出结果是
#include<iostream>
using namespace std;
class MyClass
public:
MyClass(int i=0)cout<<1;
MyClass(const MyClass&x)cout<<2;

int main( )
MyClass objl(1),obj2(2),ohj3(objl);
return 0;

A. 112
B. 111
C. 121
D. 113
[单项选择]下列程序的输出结果是 #include <iostream> using namespace std; int main ( ) { char a[] = "Hello,World": char*ptr = a; while (*ptr) { if(*ptr>= ’a’ &&*ptr <=’z’ cout<<char{*ptr+’A’-’a’); else cout<<*ptr; ptr++; } return 0; }
A. HELL WORLD
B. Hello, World
C. hELLO, wORLD
D. hello, world
[单项选择]下列程序的输出结果是
   #include" iostream"
   using namespace std;
   int Max(int a,int b)
    
     if(a > b)
     else
       return a;
     else
      retum b;
     
     void main( )
     
      int m,n;
      m=10,n=5;
      int max=Max(m,n);
      cout < < max < < end1;

A. 10
B. 程序有误
C. 1
D. 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(int x,int y,int *z)

*z=y+x;

int main( )

int a,b,c;
add(8,4,&a);
add(6,a,&b);
add(a,b,&c);
cout<<a<<","<<b<<","<<c<<end1;
return 0;

A. 12, 10, 14
B. 12, 18, 30
C. 12, 6, 18
D. 12, 14, 30
[单项选择]如下程序的输出结果是 #include<iostream> using namespace std; class A{ public: virtual void f( ){tout<<1;} void g( ){cout<<2;} }; class B:public A{ public: virtual void f( ){cout<<3;} void g( ){cout<<4;} }; void show(A&A) {a.f( );a.g( );} int nlain( ){ B b; show(B) ; return 0; }
A. 12
B. 34
C. 14
D. 32
[单项选择]下列程序的输出结果是
#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 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 namespace std; int test(int n1,int n2) {return n1 +n2;} float test (int f1,float f2){return f1-f2;} float test(float x,float y){return(x+y)/2;} float test(float x,int y){return(x+y)*2;} void main( ){ int a1=10; float a2=2.5f; cout<<test(a1,a2); }
A. 12.5
B. 7.5
C. 6.25
D. 25
[填空题]下列程序的输出结果是【 】 #include<iostream> using namespace std; template<typenameT> Tfun(Ta,TB) {return (a<=B) a:b;} int main ( ) { cout<<fun(3,6)<<’’,’’<<fun(3.14F,6.28F)<<end1; return 0; }
[单项选择]下列程序的输出结果是【 】 #inClUde<iostream> using namespace std; intmain( ) { Char a[]="HellO,World"; Char*ptr=a; while(*ptr) { if(*ptr>=’’a’’&& *ptr <=’’Z’’) cout<<char(*ptr+’’A’’ -’’a’’); else cout<<*ptr; ptr++; } retur0; }
A. HELLO,WORLD
B. Hello,world
C. hELLO,wORLD
D. hello,world

我来回答:

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

订单号:

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