Question: Using C++ Write a function called Distance that calculates the distance between two points. - Calculate distance as square root of (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2). - sqrt() function

Using C++

Write a function called Distance that calculates the distance between two points.

- Calculate distance as square root of (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2).

- sqrt() function calculates the square root. You need to include math.h

Write a main function that

- Asks the user to define a circle using the X and Y coordinates of its center (CX and CY) and the value of its radius (R)

- Stays in a loop and asks the user to enter coordinates of a point, detects and prints if the point is inside the circle, on the circle, or outside the circle.

Write a function named InRect that detects if a point is inside a rectangle.

- No need to use it in the main.

- Determine what parameters and return type the function needs to have. It should not rely on any global variables and receive information about the rectangle and point as a parameter.

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!