Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct NightLight {
- int price;
- int height;
- int power;
- int voltage;
- bool have_motion_sensor;
- bool have_touch_control;
- bool phoneApp_control;
- string color;
- string brand;
- string producing_country;
- };
- void init(NightLight*,
- int price = 3490,
- int height = 22,
- int power = 10,
- int voltage=12,
- bool have_motion_sensor = true,
- bool have_touch_control = true,
- bool phoneApp_control = true,//control from a smartphone
- string color = "white and Gold",
- string brand = "Xiaomi",
- string producing_country = "China"
- );
- void view(NightLight nightLight){
- string str1="available";
- string str2 ="not available";
- cout<<"The Night-Light\n-------------------------------------------------------------------------------"<<endl;
- cout<<"The price: "<<nightLight.price<<" P"<<endl;
- cout<<"The height: "<<nightLight.height<<" cm"<<endl;
- cout<<"The power: "<<nightLight.power<<" Watt"<<endl;
- cout<<"The voltage: "<<nightLight.voltage<<" Volt"<<endl;
- cout<<"The color: "<<nightLight.color<<endl;
- cout<<"The brand: "<<nightLight.brand<<endl;
- cout<<"The producing country: "<<nightLight.producing_country<<endl;
- nightLight.phoneApp_control ?
- cout<<"The presence of a control from a smartphone: "<<str1<<endl:
- cout<<"The presence of a control from a smartphone: "<<str2<<endl;
- nightLight.have_motion_sensor?
- cout<<"The presence of a motion control sensor: "<<str1<<endl:
- cout<<"The presence of a motion control sensor: "<<str2<<endl;
- nightLight.have_touch_control?
- cout<<"The presence of a touch control: "<<str1<<endl:
- cout<<"The presence of a touch control: "<<str2<<endl;
- }
- void switchOn(NightLight*);
- void switchOff(NightLight*);
- void setDelayTime(NightLight*,int t);
- void connectWithPhone(NightLight*);
- void switchModeOfLight(NightLight*,int mode){
- }
- int main(){
- NightLight nightLight = {3490,22,10,12,true,true,
- true,"White and Gold","Xiaomi","China"};
- int mode;
- view(nightLight);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement