Can anyone help me to fix my code for movie netflix project?
I am working on the movie netflix project.
This is the current code I have so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#include <iostream> // library that contains basic input output functions
#include <string>
#include <sstream>
#include <vector>
using namespace std;
struct movie_t
{
string Title;
int Year;
int Rating;
} mine;
vector<movie_t> movies;
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)
{
cout << "The movie queue is empty! Please add movies to the queue. " << endl;
}
else if(choice == 2)
{
mine.Title = "The Wizard of Oz";
mine.Year = 1939;
mine.Rating = R;
cout << "Enter title: ";
getline (cin,mine.Title);
cout << "Enter Year: ";
getline (cin,mine.Year);
cout << "Rating: ";
getline (cin.mine.Rating);
movies.push_back(mine);
}
else if(choice == 3)
{
// Empty
}
else if(choice == 6)
{
cout << "Exit Program. Good Bye !" << endl;
}
else
{
cout << "Invalid Option entered" << endl;
}
}
while(choice !=6);
return 0;
}
|
There is error in these sections:
|
mine.Rating = R; // 'R' was not declared in this scope
|
|
getline (cin,mine.Year); //no matching function for call to 'getline(std::istream&, int&)'
|
|
getline (cin.mine.Rating); // 'std::istream' has no member named 'mine
|
How do I fix this?
Also, any suggestion to get this code look better??
What is R? You have not declared any variables with that name.
The getline function only works for strings. You probably want to use the >> operator instead.
Topic archived. No new replies allowed.