1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
// HEADER FILE
#include <iostream>
#include <string>
using namespace std;
enum DateFormat {numeric, standard, alternative}; //Enum was giving by instructor but I have no idea where I will be incorporating this into the program.
const int MIN_YEAR = 1900;
const int MAX_YEAR = 2015;
const string monthStr [] =
{"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November",
"December"};
const int monthDays [] =
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
class Date
{
private:
int month;
int year;
int day;
public:
bool isValidDate
void print();
};
//TEST FILE
#include <iostream>
#include <string>
using namespace std;
#include "Months.h"
void setDateValues (int&, int&, int&);
int main()
{
int mth, day, yr;
setDateValues (mth, day, yr);
Date dateobj;/* Create a Date instance (object) from the user input here*/
cout << "Date is:\n";
/* Call your print member function 3 separate times to test print the date in each of 3 formats */
}
// TEST.CPP
#include <iostream>
#include <string>
using namespace std;
#include "Months.h"
void setDateValues(int& m, int& d, int& y)
{
cout << "Enter month: ";
cin >> m;
cout << "Enter day: ";
cin >> d;
cout << "Enter year: ";
cin >> y;
}
void Date::print()
{
//I was planning on making this member function the one that displays the three formats
}
bool Date::isValidDate(int m, int d, int y)
{
// this was just me experimenting with the code. No idea if this is correct.
if (m > 12 && m < 1)
return true;
else
return false;
if (year < MAX_YEAR && year > MIN_YEAR)
return true;
else
return false;
}
| |