Question: Create a C++ program where you will use nested loops to solve a system of linear inequalities, given limits on the domains of x and

Create a C++ program where you will use nested loops to solve a system of linear inequalities, given limits on the domains of x and y. Your program should use this system of inequalities: 2x-y < 4 and x + 3y > 1 Given these inequalities, your program should take four values as input: xLow, xHigh (both integers) - Limits on the domain of x yLow, yHigh (both integers) - Limits on the domain of y Your program should use nested for loops to extend the x value from xLow to xHigh and to extend y from yLow to yHigh, in increments of one unit for each variable. For each pair (x, y) check the system of inequalities for a valid solution; if the values of x and y result in a true value for both inequalities, the (x, y) pair satisfies the system. If the (x, y) pair satisfies the system, output the pair to the screen.

Test Case #1:

Enter your x limits (low  high): 1 5 Enter your y limits (low  high): 2 7 (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (4, 5) (4, 6) (4, 7) (5, 7) 

Test Case #2:

Enter your x limits (low  high): 3 4 Enter your y limits (low  high): 4 5 (3, 4) (3, 5) (4, 5) 

Test Case #3: Change your inequalities to be y < cos(x) and sin(x) > y.

Enter your x limits (low  high): 0 4 Enter your y limits (low  high): 0 4 (1, 0) 

Test Case #4: Use the inequalities from Test Case #3.

Enter your x limits (low  high): 1 5 Enter your y limits (low  high): 1 5 There are no solutions. 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!