首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
已知下列程序的输出结果是42,请将画线处缺失的部分补充完整。 #include using namespace std; class TlestClass { int value; public: TestC
已知下列程序的输出结果是42,请将画线处缺失的部分补充完整。 #include using namespace std; class TlestClass { int value; public: TestC
admin
2013-02-27
44
问题
已知下列程序的输出结果是42,请将画线处缺失的部分补充完整。
#include
using namespace std;
class TlestClass {
int value;
public:
TestClass():value(0){};
void setValue(int value)
{__________=value;}//给TestClass的数据成员value赋值
void print(){cout<
};
int main()
{
TestClass f;
f.setValue(42);
f.print();
return 0:
}
选项
答案
this->value 或Testclass::valuc
解析
为了指明是给本类中的value变量赋值,所以利用每一个成员函数中的指针this指向该变量,或者说明是该类域中的value,TbstClass::value。
转载请注明原文地址:https://kaotiyun.com/show/NcVp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有以下程序 #include<stdio.h> main() {FILE*fp; inti,a[6]={l,2,3,4,5,6},k; fp=fopen("data.dat","w+"); for(i=0;i<6;
有以下程序: #include<stdio.h> main() { FILE*fp;charstr[10]; fp=fopen("myfile.dat","w"); fputs("abc",fp); fclose(fp)
有以下程序: #include<stdio.h> main() {FILE*fp;inta[10]={1,2,3},i,n; fp=fopen("d1.dat","w"); for(i=0;i<3;i++)
有以下程序 #include<stdio.h> main() {charx,a=’A’,b=’B’,c=’C’,d=’D’; x=(a<B)a:b; x=(x>C)c:x; x=(d>x)x:d; printf(
有以下程序: #include<stdio.h> main() { inta=1,b=2,c=3,d=0; if(a==1&&b++==2) if(b!=2||c--!=3) printf("%d,%d,%d\
若有定义:inta,b,c;以下程序段的输出结果是()。 a=11;b=3;c=0; printf("%d\n",c=(a/b,a%b));
有下列程序 #include<stdio.b> main() {intx=3,y=5,z1,z2; z1=y^x^y;z2=x^y^x; printf("%d,%d\n",z1,z2); } 程序执行后的输出结果是(
随机试题
下述关于多烯磷脂酰胆碱的描述,正确的有
前间壁心肌梗死特征性心电图改变,见于
A.滑膜B.肌肉及肌腱C.软骨D.骨E.韧带成人股骨头无菌坏死病变始于
下列关于银行监管活动中,涉及批准事项的说法错误的有:
非经常性损益是指与公司正常经营业务无直接关系,以及虽与正常经营业务相关,但由于其性质特殊和偶发性,影响报表使用人对公司经营业绩和营利能力做出正常判断的各项交易和事项产生的损益。根据上述定义,下列描述属于非经常性损益的是:
WhenLiamMcGeedepartedaspresidentofBankofAmericainAugust,hisexplanationwassurprisinglystraightup.Ratherthancl
软件生命周期中所花费用最多的阶段是
Whatisthispassagemainlyabout?
HowManybuildingplacesdoestheBuildingServicelookateachMonthtoseeifthingsaregoingonWell?Whatshouldyoudoifyo
A、ThetalksshouldincludeNorthKorea’skidnappingofJapanesecitizensduringtheColdWarperiod.B、NorthKorea’shumanright
最新回复
(
0
)