Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. class Device{
  6. protected:
  7.     bool PoweredOn;
  8.     string DeviceID;
  9.     string Manufacturer;
  10. public:
  11.     Device(): PoweredOn(0), DeviceID("M1906F9SH"), Manufacturer("KONCAR"){}
  12.     Device(bool x, string ID, string Man): PoweredOn(x), DeviceID(ID), Manufacturer(Man){}
  13.     void TurnON_OFF(bool x){
  14.         PoweredOn = x;
  15.     }
  16. };
  17.  
  18. class USBDevice: public virtual Device{
  19. protected:
  20.     bool Connected;
  21.     string USBStandard;
  22. public:
  23.     USBDevice(): Connected(0), USBStandard("2.0"), Device(0, "M1906F9SH", "KONCAR"){}
  24.     USBDevice(bool spojen1, string stand1, bool stanje1, string id1, string proiz1): Connected(spojen1), USBStandard(stand1), Device(stanje1, id1, proiz1){}
  25.     void virtual ConDisc(bool spoji1){
  26.         Connected = spoji1;
  27.     }
  28.     bool getStatusUSB(){
  29.         return Connected;
  30.     }
  31. };
  32.  
  33. class NetworkDevice: public virtual Device{
  34. protected:
  35.     bool Connected;
  36.     string NetworkStandard;
  37. public:
  38.     NetworkDevice(): Connected(0), NetworkStandard("IEEE"), Device(0, "1C", "LG"){}
  39.     NetworkDevice(bool spojen2, string stand2, bool stanje2, string id2, string proiz2): Connected(spojen2), NetworkStandard(stand2), Device(stanje2, id2, proiz2){}
  40.     void virtual ConDisc(bool spoji2){
  41.         Connected = spoji2;
  42.     }
  43.     bool getStatusNET(){
  44.         return Connected;
  45.     }
  46. };
  47.  
  48. class WirelessAdapter: public USBDevice, public NetworkDevice{
  49. private:    
  50.     int No_ofAntennas;
  51.     float Gain;
  52. public:
  53.     WirelessAdapter(): No_ofAntennas(0), Gain(2.3), Device(1, "7A", "Apple"){}
  54.     WirelessAdapter(int brA, float power, bool stanje, string id, string proiz): No_ofAntennas(brA), Gain(power), Device(stanje, id, proiz){}
  55.     void ConDisc(){
  56.         bool spoji1, spoji2;
  57.         cout << "Spojiti USB uredaj?" << endl;
  58.         cin >> spoji1;
  59.         cout << "Spojiti NET uredaj?" << endl;
  60.         cin >> spoji2;
  61.        
  62.         USBDevice::ConDisc(spoji1);
  63.         NetworkDevice::ConDisc(spoji2);
  64.     }
  65.     void Status(){
  66.         if(USBDevice::getStatusUSB() == 1){
  67.             cout << "USB je spojen!" << endl;
  68.         }
  69.         if(NetworkDevice::getStatusNET() == 1){
  70.             cout << "NET je spojen!" << endl;
  71.         }
  72.     }
  73. };
  74.  
  75. int main(){
  76.     int broj, status1, status2, on_off;
  77.     float snaga;
  78.     bool stanje;
  79.     string id, proiz;
  80.    
  81.     cout << "Unesite broj antena: " << endl;
  82.     cin >> broj;
  83.     cout << "Unesite gain: " << endl;
  84.     cin >> snaga;
  85.     cout << "Unesite stanje: " << endl;
  86.     cin >> stanje;
  87.     cout << "Unesite idnetifikacijski broj: " << endl;
  88.     cin >> id;
  89.     cout << "Unesite proizvodjaca: " << endl;
  90.     cin >> proiz;
  91.     WirelessAdapter Adapter(broj, snaga, stanje, id, proiz);
  92.     Adapter.ConDisc();
  93.     Adapter.Status();
  94.     system("pause");
  95.    
  96.    
  97.    
  98.     return 0;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement