Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "Date.h"
- using namespace std;
- int main()
- {
- int test_version = 0;
- cout << "Enter the test version: ";
- cin >> test_version;
- if (test_version == 1) // test create default date and print it three ways
- {
- cout << "\nTest1: default date, printed in three formats:\n\t";
- Date day;
- day.print(1);
- cout << "\t";
- day.print(2);
- cout << "\t";
- day.print(3);
- cout << endl;
- }
- if (test_version == 2) // test create Christmas and print it three ways
- {
- cout << "\nTest2: Christmas 2019, printed in three formats:\n\t";
- Date day (12, 25, 2019);
- day.print(1);
- cout << "\t";
- day.print(2);
- cout << "\t";
- day.print(3);
- cout << endl;
- }
- if (test_version == 3) // create Christmas and extract info via get member functions
- {
- cout << "\nTest3: Christmas 2019, printed and day, month, year extracted with get member functions\n";
- Date day (12, 25, 2019);
- day.print(1);
- cout << endl;
- int month = day.getMonth();
- int dy = day.getDay();
- int year = day.getYear();
- cout << "The returned values are Month: " << day.getMonth() << "\tDay: " << day.getDay() << "\tYear: " << day.getYear() << endl;
- }
- if (test_version == 4) // create Christmas and set the date to Valentine's day next year
- {
- cout << "\nTest4: Christmas 2019, printed:\n\t\nThen make Valentine's day with set member functions\n";
- Date day (12, 25, 2019);
- day.print(1);
- cout << endl;
- if (day.setYear(2020))
- cout << "Year set without error ";
- else
- cout << "Year set WITH error ";
- if (day.setMonth(2))
- cout << "Month set without error ";
- else
- cout << "Month set WITH error ";
- if (day.setDay(144))
- cout << "Day set without error ";
- else
- cout << "Day set WITH error ";
- cout << "\n\tValentines day is: ";
- day.print(1);
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement