首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的执行结果是( )。 #include<iostream> using namespace std; class building { public: building() {} build
下面程序的执行结果是( )。 #include<iostream> using namespace std; class building { public: building() {} build
admin
2009-01-15
66
问题
下面程序的执行结果是( )。 #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://kaotiyun.com/show/50kp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有以下程序#include#includemain(){charw[20],a[5][10]={"abcdef","ghijkl","mnopq","rstuv","wxyz."};inti;for(i=0;i
下列链表中,其逻辑结构属于非线性结构的是()。
以下关于结构化程序设计的叙述中正确的是
数据库设计的根本目标是要解决
若有定义:inta,b;通过语句scanf("%d;%d",&a,&b);能把整数3赋给变量a,5赋给变量b的输入数据是
算法中,对需要执行的每一步操作,必须给出清楚、严格的规定。这属于算法的
关于程序设计结构的叙述中错误的是()。
下列选项中属于面向对象设计方法主要特征的是()。
下列说法正确的是()。
在数据库设计中,将E-R图转换成关系数据模型的过程属于()。
随机试题
通过试算平衡能够发现的错误是()。
经过大椎穴的经脉是
新安理学是中国思想史上具有重大影响的学派,其奠基人()的祖籍均在安徽新安江畔。
一般资料:女,28岁,已婚。下面是心理咨询师与求助者的咨询片断:心理咨询师:你好,请坐。你希望我为你提供哪方面的帮助?求助者:我女儿今年2岁半,我很担心她营养不良。心理咨询师:那她为什么会营养不良呢?求助者
Excel电子表格中的数据可用各种形象的图表来表示,下面哪一种不是Excel中的图表类型?()
某公司组织员工外出旅游,共有70名员工参加,已知景点门票为80(元/人),所有人都坐车前往,现有5座和12座两种车,租用费用分别为50(元/天)、100(元/天),要求每辆车都需要坐满,司机由出租方提供.则公司组织这次旅游至少要花多少钱?
共情是指能设身处地体验他人的处境,对他人情绪情感具备感受力或理解力。根据上述定义,下列属于共情的是:
给定程序中,函数fun的功能是:有N×N矩阵,根据给定的m(m=N)值,将每行元素中的值均右移m个位置,左边置为0。例如,N=3,m=2,有下列矩阵123456789程序执行结果为0
Languageperformanceandlanguageacquisitionarethetwoprincipleconcernsofthepsychologyoflanguage,orpsycholinguistics
Everyoneissupposedtopersistinhisownprinciples,______(不论出身高贵或低贱).
最新回复
(
0
)