Originally Posted by
VerrKol
You need a hierarchy of switches. The order should be based on Venn-diangram style possibilities or you can draw the classic logic diagram.
Something like
Code:
if (master = 0)
{
if (gear = P)
{
if (inside stuff) {}
if (outsides stuff) {}
if (dashboard stuff) {}//not necessarily in this order
}
}
so right now I have:
Code:
//Declare objects
bool dashboard_switch_left, dashboard_switch_right, child_lock, left_inside_handle, left_outside_handle, right_inside_handle, right_outside_handle, master_lock, gear;
//Ask user for input
cout << "Enter value for left dashboard switch (1=activated, 0=off): " << endl;
cin >> dashboard_switch_left;
cout << "Enter value for the right dashboard switch (1=activated, 0=off): " << endl;
cin >> dashboard_switch_right;
cout << "Enter value for Child Lock (1=activated, 0=off): " << endl;
cin >> child_lock;
cout << "Enter value for inside left handle (1=activated, 0=ff): " << endl;
cin >> left_inside_handle;
cout << "Enter value for outside left handle (1=activated, 0=ff): " << endl;
cin >> left_outside_handle;
cout << "Enter value for inside right handle (1=activated, 0=ff): " << endl;
cin >> right_inside_handle;
cout << "Enter value for outside right handle (1=activated, 0=ff): " << endl;
cin >> right_outside_handle;
cout << "Enter value for Master Lock (1=activated, 0=off): " << endl;
cin >> master_lock;
cout << "Enter value for gear (P=1, N,D,1,2,3,R=0): " << endl;
cin >> gear;
if (master_lock=0)
{
if (child_lock=0)
{
if (gear=1)
{
if (dashboard_switch_left=0) {}
if (left_inside_handle=0) {}
if (left_outside_handle=0)
{
cout << "Left door opens" << endl;
}
}
}
}
system("pause");
return 0;
}
I can't seem to get the "Left Door Opens" to pop up after entering the correct values….can you tell me what I'm doing wrong?
Bookmarks