Advertisement
MasterGun

12

Mar 21st, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. class TV {
  5.  
  6.     int height;
  7.     int width;
  8.     int screen_size;
  9.     int channel;
  10.     int volume;
  11.     bool power = false;
  12.  
  13.  
  14. public:
  15.     TV(int _height, int _width, int _screen_size, int _channel, int _volume, bool _power) {
  16.  
  17.         height = _height;
  18.         width = _width;
  19.         screen_size = _screen_size;
  20.         channel = _channel;
  21.         volume = 0;
  22.         power = 0;
  23.     }
  24.  
  25.     void SetPower(int a) {
  26.         if (a = 1) {
  27.             power = true;
  28.             cout << "TV is on" << power;
  29.         }
  30.         else if (a = 0) {
  31.  
  32.             power = false;
  33.             cout << "TV is off" << endl;
  34.         }
  35.         else {
  36.             cout << "ERROR 404 Command Not Found" << endl;
  37.         }
  38.     }
  39.     void SetChannel(int b) {
  40.  
  41.         if (b = 1 & 2 & 3 & 4 & 5 & 6) {
  42.  
  43.             cout << "You are on channel" << b << endl;
  44.  
  45.         }
  46.         else {
  47.  
  48.             cout << "Channel doesn't exist" << endl;
  49.  
  50.         }
  51.         void SetVolume(int c) {
  52.  
  53.             if (c = 1) {
  54.  
  55.                 volume++;
  56.                 cout << volume << endl;
  57.  
  58.             }
  59.             else {
  60.                 volume--;
  61.                 cout << volume << endl;
  62.             }
  63.  
  64.         }
  65.  
  66.  
  67.     }
  68. }
  69. //class pupil
  70. //{
  71. //public:
  72. //  int getage() {
  73. //
  74. //      return age;
  75. //
  76. //  }
  77. //  void AgeSet(int _age) {
  78. //      if (_age > 0 && _age < 100) {
  79. //
  80. //          age = _age;
  81. //          cout << "Nice" << endl;
  82. //      }
  83. //      else {
  84. //
  85. //          cout << "Error, your age can't be more than 100 years." << endl;
  86. //
  87. //      }
  88. //  }
  89. //  void weightset(int _weight) {
  90. //
  91. //      if (_weight > 0 && weight < 150) {
  92. //
  93. //          weight = _weight;
  94. //          cout << "Nice" << endl;
  95. //
  96. //      }
  97. //      else {
  98. //
  99. //          cout << "Sorry, no. Error" << endl;
  100. //
  101. //      }
  102. //
  103. //  }
  104. // 
  105. //
  106. //private:
  107. //  string name;
  108. //  int age;
  109. //  int weight;
  110. //};
  111. //class car {
  112. //
  113. //  string name;
  114. //  int speed;
  115. //  int brake;
  116. //  int year;
  117. //  int currentspeed;
  118. //  int boost;
  119. //  int brakespeed;
  120. //public:
  121. //  void setNameCar() {
  122. //
  123. //      cin >> name;
  124. // 
  125. //  }
  126. //  void getName() {
  127. //
  128. //      cout << name << endl;
  129. //
  130. //  }
  131. //  void setSpeed(int _speed) {
  132. //
  133. //      if (_speed > 0 && _speed < 400) {
  134. //
  135. //          cout << " " << endl
  136. //      }
  137. //      else {
  138. //          cout << "Error" << endl;
  139. //      }
  140. //  }
  141. //  void setCurrentSpeed(int _currentspeed) {
  142. //
  143. //
  144. //
  145. //  }
  146. //};
  147. int main(){
  148.     /*int age;
  149.     cin >> age;
  150.     int weight;
  151.     cin >> weight;
  152.     pupil pupil2;
  153.     pupil2.AgeSet(age);
  154.     pupil2.weightset(weight);*/
  155.     int a;
  156.     cin >> a;
  157.     int b;
  158.     cin >> b;
  159.     int c;
  160.     cin >> c;
  161.  
  162.     TV TV1;
  163.     TV1.SetPower(a);
  164.     TV1.SetVolume(c);
  165.     TV1.SetChannel(b);
  166.  
  167. system("pause");
  168. return 0;
  169.  
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement