首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
根据下面的程序,可以在主程序中使用的合法语句是( )。 #include <iostream> using namespace std; class Person{ int age; voidtest(){}
根据下面的程序,可以在主程序中使用的合法语句是( )。 #include <iostream> using namespace std; class Person{ int age; voidtest(){}
admin
2010-06-06
27
问题
根据下面的程序,可以在主程序中使用的合法语句是( )。 #include <iostream> using namespace std; class Person{ int age; voidtest(){} public: Person(intage){this->age=age;} void ShowAge(){cout<<"the Person’s age is",<<age;} }; void main(){ Person wang(23); }
选项
A、wang.age=45
B、wang.wang(45)
C、wang.ShowAge()
D、wang.test()
答案
C
解析
ShowAse是类的公有成员,可以由对象访问,其他的为私有成员,类对象不能访问。
转载请注明原文地址:https://jikaoti.com/ti/rcW0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
函数fun的功能是:根据所给的年、月、日,计算出该日是这一年的第几天,并作为函数值返回。其中函数isleap用来判别某一年是否为闰年。例如,若输入:200851,则程序输出:2008年5月1日是该年的第122天。请在程序的下划线处填入正确的内容,并
有以下程序#include<stdio.h>#include<string.h>structA{inta;charb[10];doublec;};structAf(structAt);
在下述程序中,判断i>j共执行的次数是()。main(){inti=0,j=10,k=2,s=0;for(;;){i+=k;if(i>j){printf("%d.t,s);bre
函数fun的功能是在a所指的具有n个元素的数组中查找最大值并返回给调用函数,函数不完整。intfun(int*a,intn){int*p,*s;for(p=a,s=a;p-a<n;p++)if(________
有以下程序段:#includeintx;floaty;chars[10];scanf(’’%3d%f%s’’,&x,&y,name);当执行上述程序段,从键盘上输入12345568Tom后,y的值为()。
有以下结构体说明、变量定义和赋值语句:structSTD{charname[10];intage;charsex;}s[5],*ps;ps=&s[0];则以下scanf函数调用语
下列给定程序中,fun函数的功能是:根据形参m,计算下列公式的值。t=1+1/2+1/3+1/4+…+1/m例如,若输入5,则应输出2.283333。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函
给定程序中,函数fun的功能是:统计形参S所指字符串中数字字符出现的次数,并存放在形参t所指的变量中,最后在主函数中输出。例如,形参S所指的字符串为:abcdef35adgh3ksdf7。输出结果为:4。请在程序的下划线处填入正确的内容并把下划线
给定程序MODI1.C中函数fun的功能是:通过某种方式实现两个变量值的交换,规定不允许增加语句和表达式。例如变量a中的值原为8,b中的值原为3,程序运行后a中的值为3,b中的值为8。请改正程序中的错误,使它能得出正确的结果。注意:不要改动mai
使用VC++2010打开考生文件夹下blank1中的解决方案。此解决方案的项目中包含一个源程序文件blank1.c。在此程序中,函数fun的功能是:将一副扑克牌编号为1,2,3,…,53,54,以某种特定的方式洗牌,这种方式是将这副牌分成两半,然后将它们交
随机试题
消防滤水器安装在进水管底部,用以阻止水藻、石子、杂草等物吸入()。
小隐静脉()
75岁女患者,右大腿卵圆窝部反复出现圆形突起已多年,此次因便秘突出包块增大,用力还纳后右下腹持续疼痛伴呕吐而求医。下腹压痛,反跳痛肌紧张,叩诊肝浊音界缩小,肠鸣音减弱。
《本草纲目拾遗》新增的药物种数是()。
胃大部切除术后出现贫血的原因是()
【2006年第88题】如图6-5所示,采用同类钢材制作的具有相同截面面积、相同截面高度(h)和腹板厚度,翼缘宽度不等的三种钢梁,当钢梁与上翼缘混凝土楼板整浇时,钢梁跨中截面的抗弯承载力大小顺序为下列哪项?(提示:混凝土强度、钢梁与楼板的连接、钢梁的稳定均有
证券市场的基本经济功能是()
某公司在生产主要产品的同时,还生产了某种副产品。该种副产品可直接对外出售,公司规定的售价为每千克100元。某月主要产品和副产品发生的生产成本总额为500000元,副产品的产量为500千克。假定该公司按预先规定的副产品的售价确定副产品的成本,则主产品应负担的
阅读材料,回答问题。材料一明清时期,形成了一个积累大量财富的商人群体——淮扬盐商。康乾年间,“奢靡风习创于盐商,而操他业以致富者群慕效之”,扬州地区物质繁荣,名流荟萃,周边乃至全国都追慕扬州,以至“作事轩昂,向日‘扬气’……尽事奢华也”。——摘编自
已知:x=-6y=39则表达式"y\x*Sgn(x)"的值为( )。
最新回复
(
0
)