问题 单项选择题

下面程序的执行结果是( )。 #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:0area is:0story is:0area is:0story is:10area is:9760.8

B.story is:nullarea is:nullstory is:nullarea is:nullstory is:10area is:9760.8

C.前两个对象输出的结果是不定的,后一个对象的结果正确

D.前两个对象没有初值,因此程序编译时出错

答案

参考答案:C

解析: 该题是关于构造函数重载的,由于前两个对象没有赋初值,值不定。

选择题
阅读理解

阅读短文,选择正确答案。

     When a terrible earthquake hit, many people were killed and many houses fell down. After the earthquake,

all the newspapers reported many stories about some of the families who were in trouble.

     One Sunday, when I was reading a newspaper, a special picture touched me. It gave the clothing sizes of

each family member. I thought that this would be a good chance to teach my children to help those who were

less lucky than themselves. I said to my seven-year-old twins, Brad and Brett, and three-year-old Meghan. "We

have so much, and these poor people now have nothing. We'll share what we have with them.”

     I filled a box with foods and clothes. While I was doing this, I encouraged the boys to choose their toys and

donate some of their less favorite things. Meghan watched quietly as the boys took out their old toys and games

and put them together. Then she walked away. A few minutes later she came back with Lucy, her much-loved

doll. She put the doll on top of the other toys. "Oh, dear," I said. "You don't have to give Lucy. You love her so

much." Meghan said, "Lucy makes me happy, Mommy. Maybe she'll make another little girl happy, too." 

     I looked at Meghan for a long moment. She taught me a lesson. It's easy to give something that we don't

want any more, but harder to give what we cherish (珍爱), isn't it?

1. The writer has _______ children.

A. one

B. two

C. three

D. four

2. The underlined word "donate" Probably means _______.

A. 捐赠

B. 丢掉

C. 展出

D. 放好

3. Lucy is the name of _______.

A. a girl

B. a game

C. a doll

D. an earthquake

4. Which of the following is true?

A. An earthquake happened in the writer's hometown.

B. The writer didn't let Meghan give her much-loved doll.

C. The writer decided to buy some clothes for those people in trouble.

D. The writer thinks it is more difficult to give what we love a lot.

5. What's the best title of this passage?

A. A Family Story.

B. The Spirit of Giving.

C. The way of helping others.

D. A Sad Experience.