Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "Playlist.h"
- using namespace std;
- void PrintMenu(string playlist){
- string ID;
- string song;
- string artist;
- int length;
- char answer;
- int Position;
- int nPosition;
- pList menu;
- cout << endl;
- cout << playlist << " PLAYLIST MENU" << endl;
- cout << "a - Add song" << endl;
- cout << "d - Remove song" << endl;
- cout << "c - Change position of song" << endl;
- cout << "s - Output songs by specific artist" << endl;
- cout << "t - Output total time of playlist (in seconds)" << endl;
- cout << "o - Output full playlist" << endl;
- cout << "q - Quit" << endl;
- cout << endl;
- while(true){
- cout << "Choose an option:" << endl;
- cin >> answer;
- cin.ignore();
- if (answer == 'q'){
- exit(1);
- }
- else if(answer == 'a'){
- cout << endl << "ADD SONG" << endl;
- cout << "Enter song's unique ID: " << endl;
- cin >> ID;
- cin.ignore();
- cout << "Enter song's name: " << endl;
- getline(cin,song);
- cout << "Enter song's length (in seconds): " << endl;
- cin >> length;
- menu.addSong(ID, song, artist, length);
- cout << playlist << " PLAYLIST MENU" << endl;
- cout << "a - Add song" << endl;
- cout << "d - Remove song" << endl;
- cout << "c - Change position of song" << endl;
- cout << "s - Output songs by specific artist" << endl;
- cout << "t - Output total time of playlist (in seconds)" << endl;
- cout << "o - Output full playlist" << endl;
- cout << "q - Quit" << endl;
- cout << endl;
- break;
- }
- else if (answer == 'd'){
- cout << endl << "REMOVE SONG" << endl;
- cout << "Enter song's unique ID: ";
- cin >> ID;
- menu.removeSong(ID);
- cout << playlist << " PLAYLIST MENU" << endl;
- cout << "a - Add song" << endl;
- cout << "d - Remove song" << endl;
- cout << "c - Change position of song" << endl;
- cout << "s - Output songs by specific artist" << endl;
- cout << "t - Output total time of playlist (in seconds)" << endl;
- cout << "o - Output full playlist" << endl;
- cout << "q - Quit" << endl;
- cout << endl;
- break;
- }
- else if(answer == 'c'){
- cout << endl << "CHANGE POSITION OF SONG" << endl;
- cout << "Enter song's current position: " ;
- cin >> Position;
- cin.ignore();
- cout << "Enter new position for song " ;
- cin >> nPosition;
- menu.updatePosition(Position, nPosition);
- cout << playlist << " PLAYLIST MENU" << endl;
- cout << "a - Add song" << endl;
- cout << "d - Remove song" << endl;
- cout << "c - Change position of song" << endl;
- cout << "s - Output songs by specific artist" << endl;
- cout << "t - Output total time of playlist (in seconds)" << endl;
- cout << "o - Output full playlist" << endl;
- cout << "q - Quit" << endl;
- cout << endl;
- break;
- }
- else if (answer == 's'){
- cout << endl << "OUTPUT SONGS BY SPEICIFC ARTIST" << endl;
- cout << "Enter artist's name: " ;
- cin >> artist;
- menu.artistSong(artist);
- cout << playlist << " PLAYLIST MENU" << endl;
- cout << "a - Add song" << endl;
- cout << "d - Remove song" << endl;
- cout << "c - Change position of song" << endl;
- cout << "s - Output songs by specific artist" << endl;
- cout << "t - Output total time of playlist (in seconds)" << endl;
- cout << "o - Output full playlist" << endl;
- cout << "q - Quit" << endl;
- cout << endl;
- break;
- }
- else if (answer == 't'){
- cout << endl << "OUTPUT TOTAL TIME OF PLAYLIST (IN SECONDS)" << endl;
- cout << "Total time: " ;
- cout << menu.tTime();
- cout << " seconds" << endl;
- menu.tTime();
- cout << playlist << " PLAYLIST MENU" << endl;
- cout << "a - Add song" << endl;
- cout << "d - Remove song" << endl;
- cout << "c - Change position of song" << endl;
- cout << "s - Output songs by specific artist" << endl;
- cout << "t - Output total time of playlist (in seconds)" << endl;
- cout << "o - Output full playlist" << endl;
- cout << "q - Quit" << endl;
- cout << endl;
- break;
- }
- else if (answer == 'o'){
- cout << playlist << " - OUTPUT FULL PLAYLIST" << endl;
- menu.Print();
- cout << playlist << " PLAYLIST MENU" << endl;
- cout << "a - Add song" << endl;
- cout << "d - Remove song" << endl;
- cout << "c - Change position of song" << endl;
- cout << "s - Output songs by specific artist" << endl;
- cout << "t - Output total time of playlist (in seconds)" << endl;
- cout << "o - Output full playlist" << endl;
- cout << "q - Quit" << endl;
- cout << endl;
- break;
- }
- }
- }
- int main(){
- string pTitle;
- cout << "Enter playlist's title:" << endl;
- getline(cin,pTitle);
- PrintMenu(pTitle);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement