Question: Please write a C++ program that checks whether a set of 2D points satisfy a given equation or not. A 2D point has two integer
Please write a C++ program that checks whether a set of 2D points satisfy a given equation or not. A 2D point has two integer values x and y. All 2D points are stored in a text file called pairs.txt. Each line has two values for x and y, respectively. The equation to be checked is y = 5*x + 7 For example a point (x=0,y=1) does not satisfy this equation because 15*0+7. But another point (x=2,y=17) does satisfy this equation because 17=5*2+7. In your program I expect you to write a function called checkEquation() that takes an input point (x and y) as input and returns true if the point satisfy the equation. Otherwise it returns false. The prototype of the function is bool checkEquation(int x, int y) In the main function, you will read the points from the file. Later, you will call checkEquation() function for each point in a loop, and you will print a message for each point. For example: Point (0,1) does NOT satisfy the equation y=5*x + 7 Point (2,17) does satisfy the equation y=5*x+7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
