-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
46 lines (40 loc) · 1.25 KB
/
main.cpp
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
# include "Date.h"
# include <iostream>
using namespace std;
int main() {
cout << "DateCaculator" << endl;
cout << "author: He Yingzhe\nversion: 1.0\nmail: [email protected]" << endl;
cout << "This program can calculate the date after or before the input date." << endl;
cout << "This program is written in C++." << endl;
Date date1(1, 1, 1);
cout << "" << endl;
cout << "Please input the date, for example '2024 8 9' '2012 12 9'." << endl;
cout << "Write here -->";
int year1, month1, day1;
cin >> year1 >> month1 >> day1;
date1.set(year1, month1, day1);
cout << "Backward or forward from the date? (Input 'B' or 'F')" << endl;
char choice;
cout << "Write here --> ";
cin >> choice;
if (choice == 'B'){
cout << "How many days?" << endl;
int days;
cout << "Write here --> ";
cin >> days;
increment(date1, days);
} else if (choice == 'F'){
cout << "How many days?" << endl;
int days;
cout << "Write here --> ";
cin >> days;
decrement(date1, days);
} else {
cout << "Invalid input!" << endl;
exit(0);
}
cout << "The result is: ";
date1.showDate();
system("pause");
return 0;
}