I'm still new to classes and I'm having trouble assigning data to the members in an object array. I'm trying use a function to create a new object array and let the user assign data to the members of the object at the end of the array. The program shuts down after the user has entered the title. Not sure what to do. (Once I get the program to do this I'm going to copy the data, from the array that is being passes into the function, to the other elements of the new array. One step at a time though!) Any help is greatly appreciated.
DVD *addDVD(DVD *catalog, int size)
{
string line;
size = (size+1);
DVD *nptrDVDarray;
nptrDVDarray = new DVD[size];
cout<< "Enter the information about the DVD"<<endl;
// skips the '\n' in the buffer that was enterd
// when function selected from menu
cin.ignore();
// Promps user to enter data to pe copied to members
// pointed to by nprtDVDarray
cout<<" Title: "; getline(cin, line);
(nptrDVDarray + (size))->setTitle(line);
cout<<" Lenght: "; getline(cin, line);
(nptrDVDarray + (size))->setTime(line);
cout<<" Year: "; getline(cin, line);
(nptrDVDarray + (size))->setYear(line);
cout<<" Actors: "; getline(cin, line);
(nptrDVDarray + (size))->setActors(line);
return nptrDVDarray;
delete [] nptrDVDarray;
}