Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <list>
- #include <iterator>
- #include <fstream>
- using namespace std;
- string GenresFilms[10] = { "Роман","Фантастика", "Драма","Мистерия","Криминален", "Екшън", "Ужаси", "Документален", "Трилър", "Комедия" };
- class CFilms {
- private:
- string m_nameFilms;
- string m_producer;
- int m_circulation; //тираж
- int m_year;
- string m_genre;
- public:
- //подразбиращ конструктор
- CFilms() {
- m_nameFilms = " ";
- m_producer = " ";
- m_circulation = 0;
- m_year = 0;
- m_genre = " ";
- }
- //Експлицитен конструктор
- CFilms(const string Name, const string Producer,const int Circulation, const int Year, const string Genre) {
- m_nameFilms = Name;
- m_producer = Producer;
- m_circulation = Circulation;
- m_year = Year;
- m_genre = Genre;
- }
- //Копиращ конструктор
- CFilms(const CFilms& Fcopy) {
- m_nameFilms = Fcopy.m_nameFilms;
- m_producer = Fcopy.m_producer;
- m_circulation =Fcopy.m_circulation;
- m_year = Fcopy.m_year;
- m_genre = Fcopy.m_genre;
- }
- //установяване на член променливите
- const string & GetNameFilms()const {
- return m_nameFilms;
- }
- const string & GetProducer()const {
- return m_producer;
- }
- const int & GetCirculation()const {
- return m_circulation;
- }
- const string& GetGenre()const {
- return m_genre;
- }
- const string& GetProducer()const {
- return m_producer;
- }
- void SetNameFilms(string NameFilms) {
- m_nameFilms = NameFilms;
- }
- void SetProducer(string Producer) {
- m_producer = Producer;
- }
- void SetCirculation(int Circulation) {
- m_circulation = Circulation;
- }
- void SetYear(int Year) {
- m_year = Year;
- }
- void SetGenre(string Genre) {
- m_genre = Genre;
- }
- //извеждане на екран
- friend ostream& operator<<(ostream& out,const CFilms& object){
- return out << "Movie title is: "<< object.m_nameFilms
- << ", Year: " << object.m_year
- << ", Genre: " << object.m_genre << ", Produced by: " << object.m_producer << endl;
- }
- ostream& Output(const string& FileName) {
- ofstream File(FileName);
- if (File) {
- File << "Movie title is: " << m_nameFilms << ", Year: " << m_year << ", Genre: " << m_genre << ", Produced by: " << m_producer << endl;
- }
- else throw"File not found!";
- }
- //валидация на жанра
- bool ValidationGenre(string Genere) {
- for (int i = 1; i < 10; i++)
- {
- if (GenresFilms[i] == Genere) {
- return true;
- }
- return false;
- }
- }
- //изчисляване на възрастта на филма
- int Age() {
- int ageFilms;
- ageFilms = 2021 - m_year;
- return ageFilms;
- }
- //извеждане на данните за филма на принтер
- void PrinterOut() {
- CFilms array[11];
- ofstream PrinterFile("Print_Films");
- for (int i = 0; i < 10; i++) {
- PrinterFile << array[i];
- PrinterFile << endl;
- }
- PrinterFile.close();
- }
- //оператор =
- const CFilms operator = (const CFilms& obj) {
- CFilms m_Temp(obj);
- return m_Temp;
- }
- //лофически оператор, който проверява дали филма е създаден пез текущата година
- bool MovieYearCheck(int YEAR) {
- if (m_year == YEAR) {
- return true;
- }
- else return false;
- }
- //оператор > (по тираж)
- bool operator > (const CFilms& object) {
- return m_circulation > object.m_circulation;
- }
- //оператор за съвпадение (по продуцент)
- bool operator ==(const CFilms& object) {
- return m_producer == object.m_producer;
- }
- };
- class CRazprostranitel : CFilms{
- private:
- vector<CFilms>m_vFilms;
- string m_Name;
- int m_numberFilms;
- int m_Revenue;
- public:
- CRazprostranitel() {
- m_Name = " ";
- m_numberFilms = 0;
- m_Revenue = 0;
- }
- //Експлицитен
- CRazprostranitel(vector<CFilms>Objects, const string Name, const int NumberFilms, const int Revenue) {
- m_Name = Name;
- m_numberFilms = NumberFilms;
- m_Revenue = Revenue;
- }
- //обект чрез друг обект
- CRazprostranitel(const CRazprostranitel& object) {
- m_vFilms = object.m_vFilms;
- m_Name = object.m_Name;
- m_numberFilms = object.m_numberFilms;
- m_Revenue = object.m_Revenue;
- }
- //установяване на член променливите
- vector<CFilms>GetFilms()const {
- return m_vFilms;
- }
- const string GetName()const {
- return m_Name;
- }
- const int GetNumberFilms()const {
- return m_numberFilms;
- }
- const int GetRevenue()const {
- return m_Revenue;
- }
- //проверка за повече от 1 път
- bool ContentFilms(CFilms object) {
- int iCount = 0;
- /*for each (m_vFilms.begin(), m_vFilms.end(),)
- {
- }*/
- }
- };
Add Comment
Please, Sign In to add comment