👍 g++ library.cpp && ./a.out
Enter one of the following options:
1. Include a book in the catalog
2. Check out a book
3. Return a book
4. Status
5. Exit
Your option? 5
👍 cat library.cpp
#include <iostream>
using namespace std;
class Book {
public:
Book() {
}
};
class Author {
public:
Author() {
}
};
void includeBook() {
cout << "in includeBook()" << endl;
Author newAuthor;
Book newBook;
}
int menu() {
int option;
cout << "\nEnter one of the options:\n"
<< "1. Include a book in catalog\n"
<< "2. Check out a book\n"
<< "3. Return a book\n"
<< "4. Status\n"
<< "5. Exit\n"
<< "Your option? ";
cin >> option;
cin.get();
return option;
}
int main() {
while (true)
switch (menu()) {
case 1: includeBook(); break;
case 5: return 0;
default: cout << "try again: ";
}
}
ch7.4 Case Study: Spell Checker p373/391 of