Creating a DVD menu for a library system

Hi guys,

I am in the process of creating a library system. I am creating a Dvd menu now and this how it looks right now:

switch (dvdOption){

case '1':
cout << "Enter Name of DVD: ";
cin.getline( name, 80);
DVD *item;
item = lib.searchDVD( name );
if( item != NULL){
cout << "DVD already exist, do you want to update the existing DVD?" << endl;
cout << "1 for Yes" << endl;
cout << "2 for No" << endl;
cin >> response;
if (response == '1'){

}
}
cout << "Enter Director of DVD: ";
cin.getline(director, 80);
cout << "Enter no of copies: ";
cin.getline(copies, 80);
lib.insertDVD( name, director, atoi(copies));
break;
case '2':
cout << "Enter Name of DVD:\n";
cin.getline(name, 80);
lib.deleteDVD(name);
break;
case '3':
cout << "Enter Name of DVD:\n";
cin.getline(name, 80);
DVD *item;
item = lib.searchDVD( name );
if( item != NULL){
cout << "DVD found\n" << item->name << endl << item->director << endl << item->copies << endl;
}
else
cout << "DVD not found\n";
break;
case '4':
break;
case '5':
exit(0);
break;
case '6':
cout << "Invalid selection!" << endl;
system("pause");
break;
}
}
Currently when I add a new dvd to the database and then add another dvd with the same name and author it doesn't get updated, so when I search for it I get the first dvd that was added. So what I would like to do is when I select the option of adding a new DVD it will ask for a name and then the system should search the library and see if it already exists if it does it should give another option asking whether you want update the existing DVD. I have done the searching part but need help updating the system with new details entered.

Thanks.
I suppose searchDVD function return a reference so then you could do all the changes with the item pointer, assuming the database is accessible.

Aceix.
Topic archived. No new replies allowed.