Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. class Cinema
  6. {
  7. protected:
  8. char title[64];
  9. public:
  10. Cinema();
  11. Cinema(char *titleM);
  12. void set_title(char *titleM);
  13. };
  14.  
  15. Cinema::Cinema()
  16. {
  17. strcpy_s(title, "0");
  18. }
  19. Cinema::Cinema(char *titleM)
  20. {
  21. set_title(titleM);
  22. }
  23. void Cinema::set_title(char *titleM)
  24. {
  25. strcpy_s(title, titleM);
  26. }
  27.  
  28. //////////////////////////////////////////////////////
  29.  
  30. class Remake : public Cinema
  31. {
  32. private:
  33. int year;
  34. float rating;
  35. public:
  36. Remake();
  37. Remake(int yearM, float ratingM);
  38. void set(int yearM, float ratingM);
  39. void show();
  40. };
  41.  
  42. Remake::Remake()
  43. {
  44. year = 0;
  45. rating = 0;
  46. }
  47. Remake::Remake(int yearM, float ratingM)
  48. {
  49. set(yearM, ratingM);
  50. }
  51. void Remake::set(int yearM, float ratingM)
  52. {
  53. year = yearM;
  54. rating = ratingM;
  55. }
  56. void Remake::show()
  57. {
  58. cout << "Remake title: " << title << endl;
  59. cout << "Year: " << year << endl;
  60. cout << "Rating: " << rating << endl;
  61. }
  62.  
  63. //////////////////////////////////////////////////////
  64.  
  65. int main()
  66. {
  67. char title[64];
  68. int year;
  69. float rating;
  70.  
  71. cout << "Movie Title: "; cin >> title;
  72. cout << "Year of movie remake: "; cin >> year;
  73. cout << "Rating of movie remake: "; cin >> rating;
  74. cout << endl;
  75.  
  76. Remake obj;
  77. obj.set_title(title);
  78. obj.set(year, rating);
  79. obj.show();
  80.  
  81. system("pause");
  82. return 0;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement