ch18_2.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:1k
源码类别:
C#编程
开发平台:
Visual C++
- //**********************
- //** ch18_2.cpp **
- //**********************
- #include<iostream.h>
- class RMB{
- public:
- RMB(unsigned int d, unsigned int c);
- friend RMB operator +(RMB&, RMB&);
- friend RMB& operator ++(RMB&);
- void display(){ cout <<(yuan + jf / 100.0) << endl; }
- protected:
- unsigned int yuan;
- unsigned int jf;
- };
- RMB::RMB(unsigned int d, unsigned int c)
- {
- yuan = d;
- jf = c;
- while ( jf >=100 ){ //以使构造时,确保角分值小于100