c++定义一个人民币类,
#include <iostream>using namespace std;class rmb{public: rmb(){} rmb(int y,int j,int f):yuan(y),jiao(j),fen(f){} void calc_value(); float get_value() const;private: int yuan,jiao,fen; float value;};void rmb::calc_value(){ value=yuan+0.1*jiao+0.01*fen;}float rmb::get_value() const { return value;}int main(){ rmb rmb(1,2,3); rmb.calc_value(); cout<<rmb.get_value()<<endl; return 0;} 20210311