//------------------------------------------------------------------- // File :hw3.C // Author :Alicia Thorsen // Course :CS1129 // Assignment :Hw3 Solution // // Program manages a music library by allowing the user to add, // delete and view songs. The library is stored in an external // file which is read in at the beginning of the program, and // written to when the user chooses to save the library. //------------------------------------------------------------------- #include "library.h" #include using namespace std; // ------------------------------------------------------------------- // MAIN FUNCTION. // ------------------------------------------------------------------- int main() { Library lib; bool keepGoing = true; // Continue running program. char choice; // Show application logo. system("clear"); lib.showLogo(); // Load library lib.loadLibrary(); // Execute menu functions until user quits. while (keepGoing) { choice = lib.showMenu(); switch (choice) { case 'a': case 'A': // Add a song. lib.addSong(); break; case 'd': case 'D': // Delete a song. lib.deleteSong(); break; case 'v': case 'V': // View library. lib.displayLib(); break; case 'i': case 'I': // Display info about library. lib.showLibStats(); break; case 's': case 'S': // Save changes. lib.save(); break; case 'q': case 'Q': // Quit application. keepGoing = lib.quit(); break; default: // Invalid menu option. cout << "\n\nInvalid choice! Please try again.\n\n"; } } cout << "\nGoodbye!\n\n"; return 0; } // end main().