Advertisement
kirill_76rus

Stepan

Apr 24th, 2020
659
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.47 KB | None | 0 0
  1. #include <iostream>
  2. #include<math.h>
  3. #include<vector>
  4. #include<string>
  5. using namespace std;
  6. template <typename q>
  7. ostream& operator << (ostream& out, vector<q>& temp) {
  8.     for (auto& s : temp) {
  9.         cout << s << ' ';
  10.     }
  11.     cout << endl;
  12.     return out;
  13. }
  14.  
  15. class desktop
  16. {
  17. public:
  18.     void on() {
  19.         cout << "power on\n";
  20.     }
  21.     void off() {
  22.         cout << "power off\n";
  23.     }
  24.     void blocknot() {
  25.         vector<string> temp;
  26.         string tmp;
  27.         cout << "enter your text\n";
  28.         cin >> tmp;
  29.         temp.push_back(tmp);
  30.         cout << temp;
  31.     }
  32.     void calc() {
  33.         int a, b;
  34.         cin >> a >> b;
  35.         cout << a + b<<'\n';
  36.     }
  37.     void koren() {
  38.         int i;
  39.         cout << "vvedite chislo" << endl;
  40.         cin >> i;
  41.         cout << sqrt(i);
  42.  
  43.     }
  44. };
  45.  
  46.  
  47. class Facade
  48. {
  49. public:
  50.    
  51.     desktop cur;
  52.     void operation() {
  53.         cout << "0-vkluchit\n 1 - calc\n 2 - koren\n 3 - blocknot\n 4 - vuklychit\n";
  54.         int s;
  55.         cin >> s;
  56.         switch (s) {
  57.         case 0:
  58.             cur.on();
  59.             break;
  60.         case 1:
  61.             cur.calc();
  62.             break;
  63.         case 2:
  64.             cur.koren();
  65.             break;
  66.         case 3:
  67.             cur.blocknot();
  68.             break;
  69.         case 4:
  70.             cur.off();
  71.             break;
  72.         }
  73.     }
  74.        
  75. };
  76.  
  77. int main()
  78. {
  79.     while (1) {
  80.         Facade PC;
  81.         PC.operation();
  82.     }
  83.    
  84.  
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement