-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathView.cc
107 lines (81 loc) · 1.88 KB
/
View.cc
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include <iostream>
#include "Date.h"
#include "Event.h"
#include "Calender.h"
#include "View.h"
#include <string.h>
using namespace std;
/*
Function: Prints main menu
Purpose: To print main menu and return integer value based on decision
Parameters:
*/
int View::mainMenu(){
int numOptions = 1;
int selection = -1;
cout << endl;
cout << "(1) Add event" << endl;
cout << "(0) Exit" << endl;
while (selection < 0 || selection > numOptions) {
cout << "Enter your selection: ";
cin >> selection;
}
return selection;
}
/*
Function: readEvent
Purpose: To read user input on event
Parameters:
inout event name
inout day
inout month
inout year
inout hour
inout minutes
inout seconds
inout priority
*/
void View::readEvent(string &eventName,int &day,int &month,int &year, int &hour,int &minutes,int &priority){
cout << "Event name: ";
cin.ignore();
getline(cin,eventName);
cout << "day: ";
cin >> day;
cout << "month: ";
cin >> month;
cout << "year: ";
cin >> year;
cout << "hour: ";
cin >> hour;
cout << "minutes: ";
cin >> minutes;
cout << "prioritys: ";
cin >> priority;
}
/*
Function: printCalender
Purpose: To print calender
Parameters:
out calender
*/
void View::printCalender(Calender &cal) const {
cal.print();
}
/*
Function: readTypeofEent
Purpose: to read weather the user input is school or work
Parameters:
*/
int View::readTypeofEvent(){
string answer;
while (true){
cout << "School or Work Type Event?";
cin >> answer;
if (answer == "School"){
return 0;
}
else if (answer == "Work"){
return 1;
}
}
}