单项选择题
下面程序的执行结果是( )。 #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.前两个对象没有初值,因此程序编译时出错
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
需求分析阶段的任务是确定( )。
A.软件开发方法
B.软件开发工具
C.软件开发费用
D.软件系统功能
点击查看答案&解析
单项选择题
循环链表的主要优点是( )。
A.不再需要头指针了
B.从表中任一结点出发都能访问到整个链表
C.在进行插入、删除运算时,能更好地保证链表不断开
D.已知某个结点的位置后,能够容易地找到它的直接前趋
点击查看答案&解析
相关试题
模板是实现代码重用机制的一种工具,其中使...
如果一个类中含有纯虚函数,则该类称为 【...
设置虚基类的目的是解决二义性问题,可通过...
在类中定义和实现的函数称为 【11】 。
重载函数的函数名称相同,但函数的实现和功...