Advertisement
sofiamishukova

Night-Light

Mar 26th, 2020
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.17 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5.  
  6. struct NightLight {
  7.     int price;
  8.     int height;
  9.     int power;
  10.     int voltage;
  11.     bool have_motion_sensor;
  12.     bool have_touch_control;
  13.     bool phoneApp_control;
  14.     string color;
  15.     string brand;
  16.     string producing_country;
  17.  
  18.  
  19. };
  20.  
  21. void init(NightLight*,
  22.           int price = 3490,
  23.           int height = 22,
  24.           int power = 10,
  25.           int voltage=12,
  26.           bool have_motion_sensor = true,
  27.           bool have_touch_control = true,
  28.           bool phoneApp_control = true,//control from a smartphone
  29.           string color = "white and Gold",
  30.           string brand = "Xiaomi",
  31.           string producing_country = "China"
  32. );
  33.  
  34. void view(NightLight nightLight){
  35.    string str1="available";
  36.    string str2 ="not available";
  37.    cout<<"The Night-Light\n-------------------------------------------------------------------------------"<<endl;
  38.    cout<<"The price: "<<nightLight.price<<" P"<<endl;
  39.    cout<<"The height: "<<nightLight.height<<" cm"<<endl;
  40.    cout<<"The power: "<<nightLight.power<<" Watt"<<endl;
  41.    cout<<"The voltage: "<<nightLight.voltage<<" Volt"<<endl;
  42.    cout<<"The color: "<<nightLight.color<<endl;
  43.    cout<<"The brand: "<<nightLight.brand<<endl;
  44.    cout<<"The producing country: "<<nightLight.producing_country<<endl;
  45.  
  46.    nightLight.phoneApp_control ?
  47.    cout<<"The presence of a control  from a smartphone: "<<str1<<endl:
  48.    cout<<"The presence of a control  from a smartphone: "<<str2<<endl;
  49.    nightLight.have_motion_sensor?
  50.    cout<<"The presence of a motion control sensor: "<<str1<<endl:
  51.    cout<<"The presence of a motion control sensor: "<<str2<<endl;
  52.     nightLight.have_touch_control?
  53.    cout<<"The presence of a touch control: "<<str1<<endl:
  54.     cout<<"The presence of a touch control: "<<str2<<endl;
  55. }
  56.  
  57. void switchOn(NightLight*);
  58.  
  59. void switchOff(NightLight*);
  60.  
  61. void setDelayTime(NightLight*,int t);
  62.  
  63. void connectWithPhone(NightLight*);
  64.  
  65. void switchModeOfLight(NightLight*,int mode){
  66. }
  67.  
  68. int main(){
  69.     NightLight nightLight = {3490,22,10,12,true,true,
  70.                              true,"White and Gold","Xiaomi","China"};
  71.     int mode;
  72.     view(nightLight);
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement