首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的执行结果是( )。 #include<iostream> using namespace std; class building { public: building() {} build
下面程序的执行结果是( )。 #include<iostream> using namespace std; class building { public: building() {} build
admin
2009-01-15
44
问题
下面程序的执行结果是( )。 #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 area is:0 story is:0 area is:0 story is:10 area is:9760.8
B、story is:null area is:null story is:null area is:null story is:10 area is:9760.8
C、前两个对象输出的结果是不定的,后一个对象的结果正确
D、前两个对象没有初值,因此程序编译时出错
答案
4
解析
该题是关于构造函数重载的,由于前两个对象没有赋初值,值不定。
转载请注明原文地址:https://jikaoti.com/ti/cod0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
若有定义语句doublex,y,*px,*py;,执行了px=&x;py=&y;之后,正确的输入语句是()。
以下程序用来统计文件中字符的个数(函数feof用以检查文件是否结束,结束时返回非零)#includemain(){FILE*fp;longnum=O:fp=fopen(“fname.dat","r”
下列结构中属于线性结构链式存储的是
有以下定义语句,编译时会出现编译错误的是
有以下定义和语句:structworkers{intnum;charname[20];charc;struct{intday;intmonth;intyear;)s;};structwork
设fp为指向某二进制文件的指针,且已读到此文件末尾,则函数feof(fp)的返回值为()。
设有某函数的说明为int*func(inta[10],intn);则下列叙述中,正确的是
在软件生产过程中,需求信息的来源是()。
数据字典(DD)所定义的对象都包含于
在数据库设计中,将E-R图转换成关系数据模型的过程属于()。
随机试题
Anumberofpersonalcharacteristicsplayavitalroleinthedevelopmentofone’sintelligence.Butpeoplefailtorealizethe
有眼眶血管进出的鼻旁窦是
二次型可以由正交变换化作标准型,下列选项中正确的标准型为()。
《工程咨询成果质量评价办法》中规定,工业项目可行性研究报告质量标准中,对贯彻宏观调控政策情况进行综合评价,不包括对()进行论证。
建设工程项目职业健康安全管理的目的是控制影响工作场所内()健康和安全的条件和因素。
下列各项属于发票的开具要求的有()。
债券凸性对于投资者是不利的,在其他情况相同时,投资者应当选择凸性较小的债券进行投资。()
在贷款五级分类中,下列()属于不良资产。
简述《陕甘宁边区施政纲领》的主要内容和意义。
Whodoesn’tlovebeinginlove?Atruelovelistenstoyoutalkaboutwork,letsyouhavethatlast【C1】______ofpie,andusuall
最新回复
(
0
)