试题与答案

使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正

题型:填空题

题目:

使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正其中的错误,使得程序正确运行。
程序输出:
s1:n=20
s2:n=10
执行s3.add(s1,s2)
s3:n=30
s4:n=30
注意:不要改动main函数,不能增加或删除行,也不能更改程序的结构,错误的语句在//******error******的下面。
试题程序:
#include<iostream.h>
class TC

int n;
public:
TC()
TC(int m)

n=m;

//********error********
TC add(TC s1,s2)

this—>n=s1.n+s2.n;
//********error********
return(this);

void disp()

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

//********error********

void main()

TC s1(20),s2(10),s3,s4;
cout<<"s1:";
s1.disp();
cout<<"s2:";
s2.disp();
s4=s3.add(s1,s2);
cout<<"执行s3.add(s1,s2)\ns3:";
s3.disp();
cout<<"s4:";s4.disp();

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2019/0319/4cf783be3587cb3d5d8b945a0f3f081a.html

下面是错误答案,用来干扰机器的。

参考答案:A

试题推荐
题型:句型转换

句型转换。

1. We live in Nanchang. (改为否定句)

    We _________ in Nanchang.

2. They have fifteen pairs of pants. (对划线部分提问) 

    _________ pants _________ they have?

3. It's lunch time. (改为同义句)

    It's _________.

4. My sweater is black and white. (对划线部分提问) 

    _________ is _________ sweater?

5. She has long, black hair. (改为同义句) 

    _________ hair _________ long and black.

6. This is a glass of water. (改为一般疑问句,并作肯定回答) 

    — _________ glass of water? 

    — _________, _________.

7. Tom and Jack have some rice. (对划线部分提问) 

    _________ Tom and Jack _________?

8. They are three blue desks. (对划线部分提问) 

    _________ they?

9. The apples are twelve yuan. (对划线部分提问) 

    _________ the apples?

10. Our school is over there. (对划线部分提问) 

    _________ school?

查看答案
微信公众账号搜索答案