Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<math.h>
- using namespace std;
- class desktop
- {
- public:
- void on() {
- cout << "power on\n";
- }
- void off() {
- cout << "power off\n";
- }
- void notebook() {
- cout << "open notebook\n";
- }
- void sum() {
- int a, b;
- cin >> a >> b;
- cout << a + b<<'\n';
- }
- void sqr() {
- int i;
- cin >> i;
- cout << sqrt(i);
- }
- };
- class Facade
- {
- public:
- desktop cur;
- void operation() {
- cout << "0-power on\n 1 - sum\n 2 - sqrt\n 3 - notebook\n 4 - power off\n";
- int status;
- cin >> status;
- if (status == 0)
- cur.on();
- if (status == 1)
- cur.sum();
- if (status == 2)
- cur.sqr();
- if (status == 3)
- cur.notebook();
- if (status == 4)
- cur.off();
- }
- };
- int main()
- {
- while (1) {
- Facade PC;
- PC.operation();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement