Advertisement
Pandarec13

otchet

May 28th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5.  
  6. class music {
  7. public:
  8.  
  9.  
  10. void print() {
  11. cout << "жанр :" << Type << " Год: " << Year << endl;
  12. }
  13. music(string Type) {
  14. typee = Type;
  15. }
  16. string typee;
  17.  
  18. /*
  19. void m_print() {
  20. Type = Type + Year;
  21. cout << "строка + строка = " << Type;
  22. cout << endl;
  23.  
  24. Type = Year;
  25.  
  26. cout << "первая строка = второй строке : " << Type;
  27. cout << endl;
  28.  
  29. //cout << " первая строка = второй строке : " << lol_1 << endl;
  30. }*/
  31.  
  32. void enter(string type) {
  33. Type = type;
  34.  
  35. }
  36. void enter(string type, string year) {
  37. Type = type;
  38. Year = year;
  39. }
  40.  
  41. string ret_type() {
  42.  
  43. return Type;
  44. }
  45. void disp() {
  46. cout << typee << endl;
  47. }
  48.  
  49.  
  50. music();
  51. music(string);
  52. music(string, string);
  53. ~music();
  54.  
  55. private:
  56. string Type;
  57. string Year;
  58.  
  59.  
  60.  
  61. };
  62.  
  63. music::~music() {
  64.  
  65. }
  66.  
  67. music::music() {
  68. cout << "it works!" << endl;
  69. }
  70.  
  71. music::music(string type) {
  72. Type = type;
  73. type = "неизвестен";
  74. cout << "жанр : " << type << endl;
  75. }
  76.  
  77. music::music(string type, string year) {
  78. Type = type;
  79. type = "неизвестен";
  80. Year = year;
  81. year = "9999";
  82. cout << "жанр : " << type <<" Год: "<<year<< endl;
  83. }
  84.  
  85. music operator+(music c1, music c2) {
  86. return music(c1.typee +c2.typee);
  87. }
  88.  
  89. class music_music : music {
  90.  
  91. public:
  92. music_music();
  93. ~music_music();
  94. private:
  95.  
  96. };
  97. music_music::~music_music() {
  98.  
  99. }
  100.  
  101. music_music::music_music() {
  102. }
  103.  
  104.  
  105.  
  106. int main() {
  107.  
  108. setlocale(LC_ALL, "Russian");
  109. music_music mm;
  110. //mm;
  111.  
  112. music music1;
  113. music1.enter("funny", "1000");
  114. music1.print();
  115. //music1.m_print();
  116.  
  117. music music2;
  118. music2.enter("horror", "2000");
  119. music2.print();
  120. music c1 ("abv");
  121. music c2 ("gde");
  122. music c3 = c1+c2;
  123. c3.disp();
  124.  
  125. system("pause");
  126.  
  127. return 0;
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement