下面程序的执行结果是( )。
#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( );

题库:计算机等级考试 类型:最佳选择题 时间:2017-07-03 15:45:55 免费下载:《单项选择》Word试卷

下面程序的执行结果是( )。
#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.前两个对象没有初值,因此程序编译时出错

下面程序的执行结果是(  )。  #include<iostream>  using namespace std;  class building   publ

本题关键词:行为结果,面试程序,行为结果评价,竣工结算程序,行政诉讼程序,结果,执行过程组,程序,结果均,下果藤;

微信扫码获取答案解析
下载APP查看答案解析