-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cc
116 lines (85 loc) · 2.03 KB
/
main.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
108
109
110
111
112
113
114
115
/*COMPILATION INSTRUCTIONS
*
* To compile...
* 1 - update Makefile
* 2 - type "make clean"
* 3 - type "make" command
* 4 - type "clear"
* 5 - ./t01 < in.txt
* 6 - make clean
*
*/
#include <iostream>
using namespace std;
#include <string>
#include "Book.h"
#include "Library.h"
#include "Array.h"
#include "View.h"
#include "Control.h"
//#define MAX_ARR_SIZE 128 //from t01
//int mainMenu(); //commented out for t05
//void printLibrary(Book arr[MAX_ARR_SIZE], int num);
int main()
{
Control start;
start.launch();
/*commented out for t05
//Book library[MAX_ARR_SIZE]; //from t01
Library inTheLibrary; //created for t02
int numBooks = 0;
string title, author;
int id, year;
int menuSelection;
while (1) {
menuSelection = mainMenu();
if (menuSelection == 0)
break;
else if (menuSelection == 1) {
cout << "id: ";
cin >> id;
cout << "title: ";
cin.ignore();
getline(cin, title);
cout << "author: ";
getline(cin, author);
cout << "year: ";
cin >> year;
Book* book = new Book(id, title, author, year);
//library[numBooks].setBook(id, title, author, year); //from t01
//inTheLibrary->addBook(book);
inTheLibrary.addBook(book);
++numBooks;
}
}
if (numBooks > 0)
//printLibrary(library, numBooks); //from t01
inTheLibrary.print();//, numBooks);
*/
return 0;
}
/*************************************************************/
/*commented out for t05, mainMenu() now in View class
int mainMenu()
{
int numOptions = 1;
int selection = -1;
cout << endl;
cout << "(1) Add book" << endl;
cout << "(0) Exit" << endl;
while (selection < 0 || selection > numOptions) {
cout << "Enter your selection: ";
cin >> selection;
}
return selection;
}
*/
/*//from t01
void printLibrary(Book arr[MAX_ARR_SIZE], int num)
{
cout << endl << endl << "LIBRARY: " << endl;
for (int i=0; i<num; ++i)
arr[i].print();
cout << endl;
}
*/