Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 8 Weeks Ago, 5 Days Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Can someone help me with this C++ code? I do not know what to do after this.
Your task is to simulate a portion of the control software for the vehicle. The input is a sequence of values for the switches and the gear shift, in the following order:
IMPLEMENTATION:
Print “left door opens “and/or “right door opens” as appropriate. If neither door opens, print “both doors stay closed”.
Allow user the choice to continue (select another set of options) as long or he/she wishes.
#include<iostream>using namespace std;int main(){bool dash_swi_l, dash_swi_r, child_lock, master_lock, l_ins_latch, l_out_latch,r_ins_latch, r_out_latch, gear;cout <<"Enter the value of the left dashboard switch (1==on, 0==off): .\n";cin >> dash_swi_l;cout <<"Enter the value of the right dashboard switch (1==on, 0==off): .\n";cin >> dash_swi_r;cout <<"Enter the value of the child lock (1==on, 0==off): .\n";cin >> child_lock;cout << "Enter the value of the master lock (1==on, 0==off): .\n";cin >> master_lock;cout <<"Enter the value of the left inside latch (1==on, 0==off): .\n";cin >> l_ins_latch;cout <<"Enter the value of the left outside latch (1==on, 0==off): .\n";cin >> l_out_latch;cout << "Enter the value of the right inside latch (1==on, 0==ff): .\n";cin >> r_ins_latch;cout << "Enter the value for outside right outside latch (1==on, 0==ff): .\n";cin >> r_out_latch;cout << "Enter the value for the gear (P==1, N, D, 1, 2, 3, R==0): .\n";cin >> gear;if (gear=='P') {if (child_lock==0) {if (master_lock==1) {if (dash_swi_l==1) || (l_ins_latch==1) || (l_out_latch==1) &&{cout <<"The left door opens.\n";}elsecout <<"The left door stays closed.\n";if (dash_swi_r==1) || (r_ins_latch==1) || (r_out_latch==1) &&{cout <<"The right door opens.\n";}elsecout <<"The right door stays closed.\n";}elsecout <<"All of the doors stay closed.\n";elsecout <<"All of the doors stay closed.\n";}return 0;}
-----------