Overloading Arithmetic Operators, Relational Operators, and Stream Extraction and Insertion Operators

How would I go about solving a - i? Thank you for your time guys!




#include <iostream>

using namespace std;

class dateType
{
private:
int day;
int month;
int year;
public:
// constructor with default parameters
dateType(int m= -1, int d= -1, int y= 1999);

// a) overload the + operator to add dates: make sure to overload + operator as a MEMBER function!
// IMPORTANT NOTES: 1) a day value cannot be bigger than 31: you can assume that all the months will have 31 days to simplify your coding!
// 2) a month value cannot be bigger than 12.
//...

// b) overload the == operator to check if two dateType's are equal: make sure to overload == operator as a NON-MEMBER function!
//...

// c) overload >> operator to print a dateType
//...

// d) overload << operator to get a dateType from the keyboards
//...

};

dateType::dateType(int d, int m, int y)
{
month = m;
day = d;
year = y;
}


int main()
{
dateType d1(4, 12, 2014);
dateType d2(30, 1, 2014);

dateType d3;


// e) add d1 and d2 using + operator and store the result in d3
//..

// f) print d1, d2, and d3 to the screen using stream insertion operator <<
//...

// g) enter day, month, year values fromt he keyboards to d3 using stream extraction operator >>
//...

// h) print d3 to the screen using stream insertion operator <<
// ...

// i) check equality of d1 and d2 using == operator and print a message to the user on the screen accordingly
//...

system("pause");
return 0;
}
Topic archived. No new replies allowed.