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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#include <iostream>
#include<string>
#include<vector>
#include<exception>
#include <fstream>
#include <sstream>
using namespace std;
class Movie
{
private:
string movieName;
int date;
string genre;
int runtime;
float rating;
public:
Movie(string movieName, string genre, int date, int runtime, float rating)
{
this->movieName = movieName;
this->genre = genre;
this->date = date;
this->runtime = runtime;
this->rating = rating;
}
string getMoviename() { return movieName; }
void setMoviename(string movieName) { this->movieName = movieName; }
string getMoviegenre() { return genre; }
void setMoviegenre(string genre) { this->genre = genre; }
int getMovieyear() { return date; }
void setMovieyear(int date) { this->date = date; }
int getRuntime() { return runtime; }
void setRuntime(int runtime) { this->runtime = runtime; }
float getRating() { return rating; }
void setRating(float rating) { this->rating = rating; }
};
struct movies
{
string name;
string genre;
int year;
int runtime;
double rating;
movies(string name_,
string genre_,
int year_,
int runtime_,
double rating_):name(name_),genre(genre_),year(year_),runtime(runtime_),rating(rating_)
{
}
};
std::ostream& operator<<(std::ostream& os, const movies& pr)
{
return os << pr.name << " " << pr.genre << " " << pr.year << '\n';
}
class customer : public Movie
{
public:
};
int main()
{
vector<movies>movieCollection;
movies a1 = { "Zootopia", "Comedy", 2016, 110 ,8 };
movies a2 = { "Howl's Moving Castle" ,"Fantasy" ,2004 ,119 ,8.2};
movies a3 = { "Deadpool"," Action ",2016 ,109 ,8 };
movies a4 = { "Training Day","Thriller ",2001 ,122 ,7.7 };
movies a5 = {" Parasite", "Thriller", 2019 ,132 ,8.6 };
movies a6 = {"Ready Player One", "Action", 2018 ,139 ,7.5 };
movieCollection.push_back(a1);
movieCollection.push_back(a2);
movieCollection.push_back(a3);
movieCollection.push_back(a4);
movieCollection.push_back(a5);
movieCollection.push_back(a6);
for (int i = 0; i < movieCollection.size(); i++)
{
cout << movieCollection[i];
}
}
| |