#include <cstdlib>
#include <iostream>
#include <string>
#include <sstream>
usingnamespace std;
struct book
{
string title;
int price;
};
int main()
{
string answer;
book *bigbook;
bigbook = new book[1];
bigbook[0].title="harry potter";
bigbook[0].price= 300000;
cout<<endl<<"book no 0 is : "<<bigbook[0].title;
cout<<endl<<"do you want to add a new book ? (y/n)";
cin>>answer;
if(answer=="y")
{
//increase the bigbook array but dont loose en existing data
//its mean how to create bigbook[1] without loosing bigbook[0]
}
else
{
cout<<endl<<"see you later";
}
cout<<endl<<endl;
system("PAUSE");
return 0;
}
in this case, bigbook will grows to unexpected number of element, my froblem is how to add new book without loosing existing data in previous element. thanks for help