I'm making a book system, although I'm stuck.
My goal is to let a user input again after the user inputs.
ex. User inputs Book 1 then User wants to input another and make it Book 2.
Also, I want to let the user return to the main menu if he/wishes so.
ex. User is done inputting Book 1, now User wants to go back to main menu
but I can't seem to figure it out.
P.S I'm only allowed to use <iostream>
This is the code
void book::inputbook()
{
book book_number;
int choice;
cout << "\n\nEnter Book Number: "; cin >> booknumber;
cout << "Enter Book Title: "; cin.ignore(); getline (cin, booktitle);
cout << "Enter Book Author: "; getline (cin, bookauthor);
cout << "Enter Date of Publicaiton: "; cin >> bookpublish;
cout << "Do you want to input again";
cout << "[Y] or [N] = ";
cin >> choice;
if(choice == 'Y' || choice == 'y')
{
book_number.inputbook();
}
else(exit);
}
and this is the menu, I can't seem to connect it to void book::inputbook()
int menu()
{
int choice;
book book_number;
cout << "Welcome to DLC Library System\n";
cout << "Final Project in Advance Programming in C++\n\n";
cout << "Programmer\n";
cout << "ME\n\n";
cout << "====================\n";
cout << "[1] --- Input Book\n";
cout << "[2] --- Search Book\n";
cout << "[3] --- Borrow Book\n";
cout << "[4] --- Exit\n\n";
cout << "====================\n";
cout << "Input your choice: ";
cin >> choice;
switch (choice)
{
case 1: system("cls");
cout << "INPUT BOOK";
book_number.inputbook();
break;
}
}