Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<math.h>
- #include<vector>
- #include<string>
- using namespace std;
- template <typename q>
- ostream& operator << (ostream& out, vector<q>& temp) {
- for (auto& s : temp) {
- cout << s << ' ';
- }
- cout << endl;
- return out;
- }
- class desktop
- {
- public:
- void on() {
- cout << "power on\n";
- }
- void off() {
- cout << "power off\n";
- }
- void blocknot() {
- vector<string> temp;
- string tmp;
- cout << "enter your text\n";
- cin >> tmp;
- temp.push_back(tmp);
- cout << temp;
- }
- void calc() {
- int a, b;
- cin >> a >> b;
- cout << a + b<<'\n';
- }
- void koren() {
- int i;
- cout << "vvedite chislo" << endl;
- cin >> i;
- cout << sqrt(i);
- }
- };
- class Facade
- {
- public:
- desktop cur;
- void operation() {
- cout << "0-vkluchit\n 1 - calc\n 2 - koren\n 3 - blocknot\n 4 - vuklychit\n";
- int s;
- cin >> s;
- switch (s) {
- case 0:
- cur.on();
- break;
- case 1:
- cur.calc();
- break;
- case 2:
- cur.koren();
- break;
- case 3:
- cur.blocknot();
- break;
- case 4:
- cur.off();
- break;
- }
- }
- };
- int main()
- {
- while (1) {
- Facade PC;
- PC.operation();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement