Question
Could you please update the code below for the Date.cpp to output dates in this format: MM/DD/YYYY and not DD/MM/YYYY. Please, pay a closer attention
Could you please update the code below for the Date.cpp to output dates in this format: MM/DD/YYYY and not DD/MM/YYYY. Please, pay a closer attention to the output in the question below.
#include "stdafx.h"
#include
#include
#include
#include "Date.h"
using namespace std;
Date::Date()
{
month = 1;
day = 1;
year = 1970;
}
Date::Date(int m, int d, int y)
{
month = m;
day = d;
year = y;
}
void Date::setDate(int mm, int dd, int yyyy)
{
month = mm;
day = dd;
year = yyyy;
}
void Date::displayDate() const
{
cout
if (month
cout
cout
cout
}
bool Date::operator==(const Date& other) const
{
if (day == other.day && month == other.month && year == other.year)
return true;
else
return false;
}
bool Date::operator!=(const Date& other) const
{
if (day == other.day && month == other.month && year == other.year)
return false;
else
return true;
}
bool Date::operator
{
if (year return true; else if (year>other.year) return false; else { if (month return true; else if (month>other.month) return false; else { if (day return true; else return false; } } } bool Date::operator>(const Date& other) const { if (year>other.year) return true; else if (year return false; else { if (month>other.month) return true; else if (month return false; else { if (day>other.day) return true; else return false; } } } bool Date::operator { if (year return true; else if (year>other.year) return false; else { if (month return true; else if (month>other.month) return false; else { if (day return true; else return false; } } } void Date::setDefaultDate() { month = 1; day = 1; year = 1970; } bool Date::operator>=(const Date& other) const { if (year>other.year) return true; else if (year return false; else { if (month>other.month) return true; else if (month return false; else { if (day >= other.day) return true; else return false; } } } ostream &operator { output if (d.month output output output return output; } istream &operator>>(istream &input, Date &d) { int mm, dd, yyyy; input >> mm >> dd >> yyyy; d.setDate(mm, dd, yyyy); return input; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started