Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C++ Programming help needed
#8
VerrKol Wrote: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?
Reply


Messages In This Thread
C++ Programming help needed - by InvictHero - 2014-02-25, 06:43 PM
C++ Programming help needed - by Untradeable - 2014-02-25, 06:47 PM
C++ Programming help needed - by InvictHero - 2014-02-25, 06:50 PM
C++ Programming help needed - by VerrKol - 2014-02-25, 06:52 PM
C++ Programming help needed - by InvictHero - 2014-02-25, 06:59 PM
C++ Programming help needed - by Fiel - 2014-02-25, 07:00 PM
C++ Programming help needed - by InvictHero - 2014-02-25, 07:07 PM
C++ Programming help needed - by InvictHero - 2014-02-25, 07:26 PM
C++ Programming help needed - by SaptaZapta - 2014-02-25, 10:42 PM
C++ Programming help needed - by InvictHero - 2014-02-25, 10:56 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)