int main() { PlayList *playList = nullptr; cout << "Starting program !!"; while (true) { cout << "\nEnter an operation 'Create', 'Insert', 'Delete', 'Play', 'Shuffle', 'Exit'" << "\n"; string operation; cin >> operation; try { switch (FetchOpCode(operation)) { case 1: int size; cout << "Enter the size : "; cin >> size; playList = (PlayList::Create(size)); playList->Print(); break; case 2: int ordinal, value; cout << "Enter ordinal : "; cin >> ordinal; cout << "Enter trackId : "; cin >> value; if (playList == nullptr) { throw "PlayList is not created yet"; } playList->Insert(ordinal, value); playList->Print(); break; case 3: cout << "Enter ordinal : "; cin >> ordinal; if (playList == nullptr) { throw "PlayList is not created yet"; } playList->Delete(ordinal); playList->Print(); break; case 4: cout << "Enter ordinal : "; cin >> ordinal; if (playList == nullptr) { throw "PlayList is not created yet"; } playList->Play(ordinal); playList->Print(); break; case 5: if (playList == nullptr) { throw "PlayList is not created yet"; } playList->Shuffle(); playList->Print(); break; case 6: return 0; default: throw "Invalid operation"; break; } } catch (const std::exception& ex) { cout << &ex; } } }