void DeleteRecord( Node* Head ) // found record from the search { int record; printf("%s\n", "Which record do you want to delete? "); scanf(" %d", &record ); Node* SearchResult = SearchLinkedList( Head, record ); SearchResult->prev->next = SearchResult->next; }
void UpdateRecord( Node* Head ) // found record from the search { int record; printf("%s\n", "Which record do you want to update? "); scanf(" %d", &record ); Node* SearchResult = SearchLinkedList( Head, record ); char ToolName[ 30 ]; int quantity; double cost; printf("%s", "Give me the updated values: toolname quantity cost\n"); scanf(" %s %d %lf", ToolName, &quantity, &cost); strcpy( SearchResult->p.ToolName, ToolName ); SearchResult->p.quantity = quantity; SearchResult->p.cost = cost; }
int main() { ofstream outFile; ifstream inFile; //IN - file used in the function string inFileName; //IN - name of file the user will enter string outFileName; MovieInfo *head; // MovieInfo *headPtr; bool validMenuChoice; int menuChoice; Menu commandMenu; bool quit; quit = false; head = NULL; commandMenu = OUTPUT; GetFileNames(inFile,outFile,"Input"); GetFileNames(inFile,outFile,"Output"); head = ReadInput(head,inFile); // PrintHeader("Searching Linked List",'A',7,cout); // PrintHeader("Searching Linked List",'A',7,outFile); while(commandMenu != EXIT) { // do // { cout << "DVD MENU OPTIONS" << endl << endl; cout << "1 - Output Entire List" << endl; cout << "2 - Title Search" << endl; cout << "3 - Genre Search" << endl; cout << "4 - Actor Search" << endl; cout << "5 - Year Search" << endl; cout << "6 - Rating Search (0-9)"<< endl; cout << "0 - EXIT" << endl; menuChoice = ErrorCheckingMenu ("Enter an option (0 to exit): ", "**** The number is an invalid entry ****", "**** Please input a number between 0 and 6 ****", 6,0 ); // }while(); if(menuChoice > 0) { commandMenu = Menu(menuChoice); } if (commandMenu == OUTPUT && menuChoice >0) { cout << endl <<"Listing all movies!" << endl << endl; ListAllMovies(head, outFile); } else if (commandMenu == TITLESEARCH || commandMenu == GENRESEARCH || commandMenu == ACTORSEARCH || commandMenu == YEARSEARCH || commandMenu == RATINGSEARCH ) { SearchLinkedList(head,commandMenu, outFile); } } cout <<"Done reading File"; cout << "Done outputting File"; inFile.close(); outFile.close(); return 0; }