为库系统创建DVD菜单

时间:2015-03-25 22:17:08

标签: c++ eclipse oop menu

我正在创建一个图书馆系统。我现在正在创建一个Dvd菜单,现在看起来如何:

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;
        }
        }

目前,当我向数据库添加一个新的DVD,然后添加另一个具有相同名称和作者的DVD时,它没有更新,所以当我搜索它时,我得到了第一个添加的DVD。所以我想要做的是当我选择添加新DVD的选项时,它会询问一个名称然后系统应该搜索库并查看它是否已经存在,如果它确实应该提供另一个选项询问您是否需要更新现有的DVD。我已完成搜索部分,但需要帮助更新系统并输入新的详细信息。

感谢。

0 个答案:

没有答案
相关问题