Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //pastebin.com/u/thewhitefang
- //tutorial 7 q5
- #include <iostream>
- using namespace std;
- class RM {
- int m_ringgit;
- double m_sen;
- public:
- RM(){
- m_ringgit = 0;
- m_sen = 0;
- }
- RM(double inVal){
- m_ringgit = (int)inVal;
- m_sen = inVal - m_ringgit;
- }
- friend ostream &operator<<(ostream &output, const RM &source);
- };
- RM operator+ (const RM &inVal1, const RM &inVal2)
- {
- RM temp;
- };
- ostream &operator<<(ostream &output, const RM &source){
- output << source.m_ringgit << "and " <<source.m_sen <<endl;
- return output;
- }
- int main(){
- RM acct1;
- RM acct2;
- acct1 = 50.99;
- acct2 = 25.50;
- cout << "amount: " << acct1 << endl;
- cout << "acct1 + acc2: " << acct1 + acct2<< endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement