I'm writing a book program that enables the user to Add and Find books to a library. Now, I need to figure out how to receive keyboard input from the user using conio.h/any other alternative. So that if the user presses '1', the AddMenu() gets called, but if he/she presses 2, FindMenu() gets called. Here is the code:
#include <iostream>
#include <conio.h>
using namespace std;
class Book {
public:
string title; //title of da book
double sepnum; //unique identification code (ex. 1111, 0009, etc.)
};
void AddMenu() {
Book book1;
cout << "********ADD MENU********" << endl;
cout << endl;
cout << endl;
cout << "Enter Book Name:" << endl;
cin >> book1.title;
cout << "Enter Book Callsign (Ex: 0001, 5672):" << endl;
cin >> book1.sepnum;
cout << "Succesfully added" << endl;
cout << endl;
cout << "************************" << endl;
}
void FindMenu() {
}
int main()
{
cout << "**********MENU**********" << endl;
cout << endl;
cout << endl;
cout << "1. Add Book" << endl;
cout << "2. Find Book" << endl;
cout << endl;
cout << "************************" << endl;
return 0;
}