试题与答案

使用VC6打开考生文件夹下的工程test35_3。此工程包含一个test35_3.c

题型:问答题

题目:

使用VC6打开考生文件夹下的工程test35_3。此工程包含一个test35_3.cpp,其中定义了时钟类clock,但该类的定义并不完整。请按要求完成下列操作,将程序补充完整。
(1)定义类clock的私有数据成员hour和minute,它们都是int型的数据。请在注释“//**1**”之后添加适当的语句。
(2)补充完全类clock的构造函数,私有数据成员hour和minute分别初始化为参数h和m的值,请在注释“//**2**”之后添加适当的语句。
(3)完成类clock的成员函数printtime,的定义,该函数以“Now the time is hour:minute”的格式输出数据成员hour和 minute的值,如hour=3、minute=59,则输出为“Now the time is 03:59”,请在注释“//**3**”之后添加适当的语句。
(4)完成类clock的成员函数addoneminutetime的定义,该函数可将clock类对象表示的时间加一分钟,如现在hour=3、 minute=59,运行该函数后hour=4、minute=0。请在注释“//**4**”之后添加适当的语句。
程序的输出结果如下:
Now,the time is 12:59
Now,the time is 13:00
注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。
源程序文件test35_3.cpp清单如下:
#include<iostream.h>
class clock

private:
// ** 1 **
public:
clock(int h, int m)

// ** 2 **

int presenthour()return hour;
int presentminute()return minute;
void addoneminutetime();
void printtime();
;
void clock::printtime()

if(hour<10) cout<<’0’;
// ** 3 **
if(minute<10) cout<<’0’;
cout<<minute<<end1;

void clock::addoneminutetime()

// ** 4 **
if(minute>59)

minute-=60;
hour++;

if(hour>23)
hour=0;

void main ( )

clock c(12,59);
c.printtime();
c.addoneminutetime();
c.printtime();

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0704/d883e08d07f966091355fcf680394ff4.html

下面是错误答案,用来干扰机器的。

呼吸系统包括呼吸道和肺两部分.如图,呼吸道的组成由上到下依次是A鼻腔、E咽、B喉、F气管和C支气管,外界的空气进入肺依次经过鼻腔、咽、喉、气管和支气管,最后进入肺,在肺里完成气体交换.鼻腔内有鼻毛,可以...

试题推荐
题型:填空题
根据短文内容及首字母提示,填写所缺单词。
    As we know, museums are buildings where many valuable and important objects are kept so that people can
go and see them. For example, art museums are places where people can learn about 9 (1) v______ cultures.
More and more popular "design museums" that are opening today, however, perform quite a different role.
(2) U______ most art museums, the design museum shows objects that are easily found in our daily life, such
as fridges and washing machines. 
    The (3) a______ of design museums is that they are places where people feel familiar with the exhibits(展品).Being different from the art museum visitors, design museum visitors (4) s______ feel frightened or puzzled.
This is partly because design museums clearly show how and why mass-products (批量产品) work and look
as they do, and how design has (5) i______ the quality of our lives. Art museum exhibits, on the other hand,
would most probably fill visitors with a feeling that there is something (6) b______ their understanding.
   Several new design rnuseums have opened their doors in (7) r______years. Each of these museums has tried
to satisfy  (满足) the public's growing interest in the field with new (8) i_____. London's Design Museum, for
example, shows a collection of mass-produced objects from electric typewriters to a group of Italian fish-tins.
The choices open to design museums seem (9) f_______ less strict than those to art museums, and visitors
may also sense  (感觉到) the humorous part of our society while walking around such exhibits as interesting and
unusually attractive toys (10) c______ from our everyday life.
1. v_________   2. U_________   3. a__________   4. s__________    5. i__________
6. b_________   7. r__________   8. i__________   9. f__________  10. c__________
查看答案
微信公众账号搜索答案