Hmm, ok, so I've got my getMonthName function
Code:
//function to return the MonthName to main
std::string Date::getMonthName (int m)
{
std::string name = "Blank";
if (m == 1)
name = "January";
else if (m == 2)
name = "February";
else if (m == 3)
name = "March";
else if (m == 4)
name = "April";
else if (m == 5)
name = "May";
else if (m == 6)
name = "June";
else if (m == 7)
name = "July";
else if (m == 8)
name = "August";
else if (m == 9)
name = "September";
else if (m == 10)
name = "October";
else if (m == 11)
name = "November";
else if (m == 12)
name = "December";
return name; //send the Month's name back to main
} //end getMonthName
And, I've got my main function
Code:
// DateDemo.cpp
#include <iostream>
#include <iomanip>
#include <string>
using std::cout;
using std::endl;
using std::setfill;
using std::setw;
using std::string;
#include "Date_Hardesty.h"
// note - you may need to change the definition of the main function to
// be consistent with what your C++ compiler expects.
//int _tmain(int argc, _TCHAR* argv[])
int main()
{
int month;
Date d1; // default ctor
Date d2(7, 4, 1976); // July 4'th 1976
Date d3(0, 15, 1880);// Adjusted by ctor to January 15'th 1900
d1.print(); // prints 01/01/2000
d1.printLong(); // prints 1 January 2000
cout << endl;
d2.print(); // prints 07/04/1976
d2.printLong(); // prints 4 July 1976
cout << endl;
d3.print(); // prints 01/15/1900
d3.printLong(); // prints 15 January 1900
cout << endl;
cout << "object d2's day is " << d2.getDay() << endl;
cout << "object d2's month is " << d2.getMonth() <<
" which is " << d2.getMonthName(month) << endl;
cout << "object d2's year is " << d2.getYear() << endl;
return 0;
}
But, I seem to be missing how to print the correct long version of my d2 Date. Do you need to see more code?
Here's my output:
01/01/2000
01 January 2000
07/04/1976
04 July 1976
00/15/1880
15 Blank 1880
object d2's day is 4
object d2's month is 7 which is Blank
object d2's year is 1976