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

[单项选择]以下程序段有( )处错误。 #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<<end1; } }; int main ( ) { const Sample a(lO); a. setvalue (5)’; a.display( ); return 0; }
A. 1
B. 2
C. 3
D. 4

更多"以下程序段有( )处错误。 #include <iostream>"的相关试题:

[单项选择]以下程序段有( )处错误。
#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<<end1;

;
int main ( )

const Sample a(lO);
a. setvalue (5)’;
a.display( );
return 0;

A. 1
B. 2
C. 3
D. 4
[单项选择]以下程序的输出结果是( )。
#include<iostream>
using namespace std;
void fun(char**q)

++q;
cout<<*q<<end1;

main( )

static char*s[]="HI","HELL0","TEST";
char**p;
p=s;
fun(p);
system("PAUSE");
return 0;

A. 为空
B. HI
C. HELL0
D. TEST
[单项选择]有以下程序,输出结果( )。
#include<iostream>
using namespace std;
class Complex

public:
Complex(double r=0,double i=0):re(r),im(i)
double real( )constreturn re;
double imagoconstreturn im;
Complex operator+(Complex C) const
return Complex(re+c.re,im+c.im);
private:
double re,im;
;
int main( )

Complex a=Complex(1,1)+Complex(5);
cout<<a.real( )<<’+’<<a.imag( )<<’i’<<end1;
return 0;

A. 6+i
B. 2i+5
C. 6+1i
D. 1i+5
[单项选择]执行以下程序后的输出结果为 ( )。
#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
[单项选择]下列程序的输出结果是 #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;
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 swap(int &a,int &b){ int temp; temp=a; a=b; b=temp; } void main( ){ int a=2,b=3; swap(a,b); cout<<a<<"," <<b<<ENDL; }
A. 2,3
B. 3,2
C. 2,2
D. 3,3
[填空题]下列程序的输出结果是 【8】
#include<iostream>
using namespace std;
int main( )

int Bum=500;
int& ref=num;
ref+=100;
cout<<num<<end1;
return 0;

[单项选择]下面程序的执行结果是( )。
#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;
void main( )

int a,b;
for(a=1,b=l;a<=100;a++)

if(b>=10) break;
if(b%3= =1)
b+=3;continue;

cout<<a;

A. 101
B. 6
C. 5
D. 4

我来回答:

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

订单号:

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