Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.22 KB | None | 0 0
  1. #include <iostream>
  2. #include "Playlist.h"
  3.  
  4. using namespace std;
  5.  
  6. void PrintMenu(string playlist){
  7. string ID;
  8. string song;
  9. string artist;
  10. int length;
  11. char answer;
  12. int Position;
  13. int nPosition;
  14. pList menu;
  15.  
  16. cout << endl;
  17. cout << playlist << " PLAYLIST MENU" << endl;
  18. cout << "a - Add song" << endl;
  19. cout << "d - Remove song" << endl;
  20. cout << "c - Change position of song" << endl;
  21. cout << "s - Output songs by specific artist" << endl;
  22. cout << "t - Output total time of playlist (in seconds)" << endl;
  23. cout << "o - Output full playlist" << endl;
  24. cout << "q - Quit" << endl;
  25. cout << endl;
  26. while(true){
  27. cout << "Choose an option:" << endl;
  28. cin >> answer;
  29. cin.ignore();
  30.  
  31. if (answer == 'q'){
  32. exit(1);
  33. }
  34. else if(answer == 'a'){
  35. cout << endl << "ADD SONG" << endl;
  36. cout << "Enter song's unique ID: " << endl;
  37. cin >> ID;
  38. cin.ignore();
  39. cout << "Enter song's name: " << endl;
  40. getline(cin,song);
  41. cout << "Enter song's length (in seconds): " << endl;
  42. cin >> length;
  43. menu.addSong(ID, song, artist, length);
  44. cout << playlist << " PLAYLIST MENU" << endl;
  45. cout << "a - Add song" << endl;
  46. cout << "d - Remove song" << endl;
  47. cout << "c - Change position of song" << endl;
  48. cout << "s - Output songs by specific artist" << endl;
  49. cout << "t - Output total time of playlist (in seconds)" << endl;
  50. cout << "o - Output full playlist" << endl;
  51. cout << "q - Quit" << endl;
  52. cout << endl;
  53. break;
  54.  
  55. }
  56. else if (answer == 'd'){
  57. cout << endl << "REMOVE SONG" << endl;
  58. cout << "Enter song's unique ID: ";
  59. cin >> ID;
  60. menu.removeSong(ID);
  61. cout << playlist << " PLAYLIST MENU" << endl;
  62. cout << "a - Add song" << endl;
  63. cout << "d - Remove song" << endl;
  64. cout << "c - Change position of song" << endl;
  65. cout << "s - Output songs by specific artist" << endl;
  66. cout << "t - Output total time of playlist (in seconds)" << endl;
  67. cout << "o - Output full playlist" << endl;
  68. cout << "q - Quit" << endl;
  69. cout << endl;
  70. break;
  71. }
  72. else if(answer == 'c'){
  73. cout << endl << "CHANGE POSITION OF SONG" << endl;
  74. cout << "Enter song's current position: " ;
  75. cin >> Position;
  76. cin.ignore();
  77. cout << "Enter new position for song " ;
  78. cin >> nPosition;
  79. menu.updatePosition(Position, nPosition);
  80. cout << playlist << " PLAYLIST MENU" << endl;
  81. cout << "a - Add song" << endl;
  82. cout << "d - Remove song" << endl;
  83. cout << "c - Change position of song" << endl;
  84. cout << "s - Output songs by specific artist" << endl;
  85. cout << "t - Output total time of playlist (in seconds)" << endl;
  86. cout << "o - Output full playlist" << endl;
  87. cout << "q - Quit" << endl;
  88. cout << endl;
  89. break;
  90. }
  91. else if (answer == 's'){
  92. cout << endl << "OUTPUT SONGS BY SPEICIFC ARTIST" << endl;
  93. cout << "Enter artist's name: " ;
  94. cin >> artist;
  95. menu.artistSong(artist);
  96. cout << playlist << " PLAYLIST MENU" << endl;
  97. cout << "a - Add song" << endl;
  98. cout << "d - Remove song" << endl;
  99. cout << "c - Change position of song" << endl;
  100. cout << "s - Output songs by specific artist" << endl;
  101. cout << "t - Output total time of playlist (in seconds)" << endl;
  102. cout << "o - Output full playlist" << endl;
  103. cout << "q - Quit" << endl;
  104. cout << endl;
  105. break;
  106. }
  107. else if (answer == 't'){
  108. cout << endl << "OUTPUT TOTAL TIME OF PLAYLIST (IN SECONDS)" << endl;
  109. cout << "Total time: " ;
  110. cout << menu.tTime();
  111. cout << " seconds" << endl;
  112. menu.tTime();
  113. cout << playlist << " PLAYLIST MENU" << endl;
  114. cout << "a - Add song" << endl;
  115. cout << "d - Remove song" << endl;
  116. cout << "c - Change position of song" << endl;
  117. cout << "s - Output songs by specific artist" << endl;
  118. cout << "t - Output total time of playlist (in seconds)" << endl;
  119. cout << "o - Output full playlist" << endl;
  120. cout << "q - Quit" << endl;
  121. cout << endl;
  122. break;
  123. }
  124. else if (answer == 'o'){
  125. cout << playlist << " - OUTPUT FULL PLAYLIST" << endl;
  126. menu.Print();
  127. cout << playlist << " PLAYLIST MENU" << endl;
  128. cout << "a - Add song" << endl;
  129. cout << "d - Remove song" << endl;
  130. cout << "c - Change position of song" << endl;
  131. cout << "s - Output songs by specific artist" << endl;
  132. cout << "t - Output total time of playlist (in seconds)" << endl;
  133. cout << "o - Output full playlist" << endl;
  134. cout << "q - Quit" << endl;
  135. cout << endl;
  136. break;
  137. }
  138. }
  139. }
  140.  
  141.  
  142. int main(){
  143. string pTitle;
  144. cout << "Enter playlist's title:" << endl;
  145. getline(cin,pTitle);
  146. PrintMenu(pTitle);
  147. return 0;
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement