-
Notifications
You must be signed in to change notification settings - Fork 0
/
View.cc
88 lines (61 loc) · 1.63 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
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
#include "View.h"
//View ctor
View::View(){
}
//View dtor;
View::~View(){
}
//Displays the main menu and reads in the user's selection
void View::mainMenu(int& selectionRef){
int numOptions = 1;
selectionRef = -1;
cout << endl;
cout << "(1) Add student" << endl;
cout << "(0) Exit" << endl;
cin >> selectionRef;
while(selectionRef < 0 || selectionRef > numOptions){
cout << "Enter your selection: ";
cin >> selectionRef;
}
return;
}
//Reads in the student id
void View::readsInStudentId(int& idRef){
cout << "student id : ";
cin >> idRef;
return;
}
//Reads all info from the user about one book
void View::readsInCourseInfo(int& codeRef, int& gradeRef, int& termRef, string& courseInsRef){
//User inputs course code here or 0 to break/end inputting
cout << "course code <0 to end>: ";
cin >> codeRef;
cout << endl;
if(codeRef == 0){
return;
}
//User inputs number grade
cout << "grade: ";
cin >> gradeRef;
cout << endl;
//User inputs term here
cout << "term (YYYYTT): ";
cin >> termRef;
cout << endl;
//User inputs course instructor's name here
cout << "course instructor: ";
cin.ignore();
getline(cin, courseInsRef);
return;
}
//Prints out the contents in the Storage (ie Student Id and courses, takes
//a Storage reference as a parameter, uses delegation to
//ask the Storage class to print to the screen
void View::print(Storage& inStorageRef){
inStorageRef.print();
return;
}