#include <iostream>
#include "money.h"
#include <iomanip>
usingnamespace std;
int main()
{
money M1, M3;
money M2(7,75);
int d, c, dollars, cents;
M1.setMoney(5,5);
cout << "enter the dollar value for M3" << endl;
cin >> dollars;
cout << "enter the cent value for M3" << endl;
cin >> cents;
M3.setMoney(dollars,cents);
cout << "money 1 is ";
M1.print();
cout << endl;
cout << "money 2 is ";
M2.print();
cout << endl;
cout << "money 3 is ";
M3.print();
cout << endl;
if (M2.equalMoney(M3))
cout << "Money2 and Money3 are the same value" << endl;
else
cout << "Money2 and Money3 are different values" << endl;
system("pause");
return 0;
}
and this is my header file with class included
1 2 3 4 5 6 7 8 9 10 11 12 13 14
class money
{
public:
money(int d = 0, int c = 0);
void setMoney(int d, int c);
void getMoney(int & d, int & c) const;
void print() const; // in the form $1.05
int dollarsToCents() const; // converts $1.05 to 105 cents
bool equalMoney(money otherMoney) const; // checks if two money objects are equal
private:
int dollars;
int cents;
};
any other tips you may offer other then the error messages are also greatly appreciated, thanks