文件名称:counter

  • 所属分类:
  • C#编程
  • 资源属性:
  • 上传时间:
  • 2017-12-23
  • 文件大小:
  • 1kb
  • 下载次数:
  • 0次
  • 提 供 者:
  • Neko*****
  • 相关连接:
  • 下载说明:
  • 别用迅雷下载,失败请重下,重下不扣分!
下载
别用迅雷、360浏览器下载。
如迅雷强制弹出,可右键点击选“另存为”。
失败请重下,重下不扣分。

介绍说明--下载内容均来自于网络,请自行研究使用

定义一个类,类名为CounterType。这个类的对象用于计数,记录一个非负的整数。为该类写一个默认构造函数,它能将计数器置0;再写一个构造函数,它接收一个参数,用于将计数器设为由参数指定的值。编写两个成员函数,分别使计数能够递增1和递减1。确保任何成员函数都不允许计数器为负值。成员函数void reset( );能在任何时候将计数器的值重置为0。编写两个成员函数,一个返回当前计数器的值,另一个将计数器的值输出到一个流,这个用于输出的函数有一个ostream类型的形式参数(被调用时,实际参数可以是cout)。考虑哪些成员函数定义为常成员函数。
定义主函数,测试这个类。(Define a class named CounterType. The object of this class is used for counting, recording a non negative integer. Write a default constructor for this class. It can set the counter to 0, and then write a constructor, which receives a parameter, which is used to set the counter to the value specified by the parameter. Two member functions are written to increase the count by 1 and decrease by 1 respectively. Make sure that any member function does not allow the counter to be negative. The member function void reset (); can reset the value of the counter to 0 at any time. Two member functions are written, one returns the value of the current counter, and the other outputs the counter value to a stream. The output function has a ostream type formal parameter (when called, the actual parameter can be cout). Consider which member functions are defined as regular member functions.

Define the main function and test the class.)相关搜索: c#
计数器

(系统自动生成,下载前可以参看下载内容)

下载文件列表

文件名大小更新时间
counter.c 507 2017-12-23
counter.h 507 2017-12-23
ReadMe.txt 1250 2017-12-23

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度更多...
  • 请直接用浏览器下载本站内容,不要使用迅雷之类的下载软件,用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*主  题:
*内  容:
*验 证 码:

源码中国 www.ymcn.org