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;
    }
}

This does not appear to be about the iostream limitation but about design. That is, your assignment is to craft/create this mini-app. So I can't write code for you but share that you need to step back and design before code.

That is, you know you need an outer loop to keep going till exit. Then an inner loop to hold that menu and perform those actions. I don't see you using any loop construct. Look up do and while on the usual tutorials.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.