Can someone please teach me how can I add a Yes or No loop in this program? This is a simple library system which will store 20 book titles with a maximum of 50 characters each. Every time after the user inputs a title, it will prompt for a yes or no. If the user inputs yes, it will ask for another title. if no, it will display the title of the books stored in the array.
Code:
#include <iostream>
using namespace std;
int main()
{
char book[20][50],choice;
int index;
cout<< "ADDING BOOK - MMSU LIBRARY";
for ( int i = 0; i < 20; i++ )
{
cout << "\n\nTitle: :";
cin.getline(book[i], 50);
}
system("cls");
cout << "DISPLAY BOOK - MMSU Library System";
cout << "\n\nBook Index" " \tTitle";
for ( int i = 0; i < 20 ; i++ )
{
index=i+1;
cout<<endl<<" "<<index<<"\t\t"<<book[i]<<endl;
}
system("pause");
return 0;
}