Hello guys, I am currently working on the movie netflix queue project.
I need help with some codes.
This is how far I got to:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
int main()
{
int choice;
do
{
cout << "1. Display Movie Queue " << endl;
cout << "2. Add Movie to Queue " << endl;
cout << "3. Edit Movie in Queue" << endl;
cout << "4. Remove Movie from Queue " << endl;
cout << "5. Search for Movie in Queue " << endl;
cout << "6. Exit Program " << endl;
cout << "Enter option : ";
cin >> choice;
if(choice == 1) // Checking if user selected option 1
{
cout << "The movie queue is empty! Please add movies to the queue. " << endl;
}
As 'Zhuge' mentioned, you can use data structures that hold data. However, if you don't know data structures, then you can use vectors (they're pretty simple).
vector<string>myVec;
string movieName;
if (choice == 2)
{
cout << "Enter Movie: "; // ask for moviename
getline(cin, movieName);
myVec.pushback(movieName); // store moviename in vector
}
if (choice == 1)
{
for (int i=0; i < myVec.size(); i++) // iterates over entire vector and prints out all data
{
cout << myVec[i] << endl;
}
}