简答题:请使用VC6或使用【答题】菜单打开考生文件夹projl下的工程projl,该工程含有一个源程序文件pn,jl.cpp。其

  • 题目分类:C++
  • 题目类型:简答题
  • 查看权限:VIP
题目内容:
请使用VC6或使用【答题】菜单打开考生文件夹projl下的工程projl,该工程含有一个源程序文件pn,jl.cpp。其中位于每个注释“//ERROR 木}}水found}}水木”之后的一行语句存在错误。请改正这些错误,使程序的输出结果为:
The value is 10
注意:只修改注释“//ERROR **** found****”的下一行语句,不要改动程序中的其他内容。
//pmjl.cpp
#include<iostream>
using namespace std;
class MyClass{
int value;
public:
//ERROR********found*********
void MyClass(int val):value(val){}
int GetValue()const{return value;}
void SetValue(int val);
};
//ERROR********found********
inline void SetValue(int val){value=val;}
int main()
MyClass obj(O);
obj.SetValue(10);
//ERROR********found********下列语句功能是输出obj的成员value的值
tout<<”The value is”<<obj.value<<endl:
return 0;
}
参考答案:
答案解析:

由于常对象不能被更新,因此( )。

由于常对象不能被更新,因此( )。 A.通过常对象只能调用它的常成员函数 B.通过常对象只能调用静态成员函数 C.常对象的成员都是常成员 D.通过常对象可以调用

查看答案

下列语句中,错误的是( )。

下列语句中,错误的是( )。 A.const int buffer:256; B.const int temp; C.const double*point

查看答案

Scenario I'm going to describe a situation.Your company is

Scenario I'm going to describe a situation.Your company is going to provide

查看答案

·YOU will hear five recordings.·For each recording,decide w

·YOU will hear five recordings.·For each recording,decide what the person’s jo

查看答案

Conversation Three(Questions 9-12)·Look at the note below.·Y

Conversation Three(Questions 9-12)·Look at the note below.·You will hear a ma

查看答案