I have made a book storage program in c++. It is program which loops over 3 times so the user can input 3 books but now I want user to pick the amount of book user wants to enter and I have no clue how to do it. It would be helpful and here is my code
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
struct Book{
string name;
int release;
}Issue[3];
int main(){
//local variable
int i;
string release_dte;
//interface
cout << "Welcome to Book Storage CPP" << endl;
//for handler
for (i = 0; i < 3; i++){
cout << "Book: ";
getline(cin, Issue[i].name);
cout << "Release Date: ";
getline(cin, release_dte);
Issue[i].release = atoi(release_dte.c);
}
cout << "These are your books" << endl;
for ( i = 0; i < 3; i++){
cout << "Book: " << Issue[i].name << " Release Date: " << Issue[i].release << endl;
}
system("pause");
return 0;
}