Question: In visual studio code, code the following prompt: Deliverable: problem 2 functions.h and problem 2 functions.cpp - Write a function named Distance that takes four
In visual studio code, code the following prompt:
Deliverable: problemfunctions.h and problemfunctions.cpp
Write a function named Distance that takes four double arguments for the x and y
coordinates of two points xyxyand returns the distance between those points
as a double. If the function is called with the coordinates of one point only, the second
points coordinates should default to the origin
Recall, the formula to compute the distance, dbetween two points is:
Example calls:
Distanceshould return the distance between the point and
the point
Write a function named OnCircle that takes the x and y coordinates of the center of a
circle as the first two parameters, the radius of the circle as the third parameter, and the
x and y coordinates of a point as the fourth and fifth parameters all doublesThe
function should return if the point lies inside of the circle, if the point lies on the
circle, and if the point lies outside of the circle.
Example calls:
OnCircleshould return because the point lies inside
the circle centered at with radius
Write a function named OnLine that takes the x and y coordinates all doublesof three
points xyxyxyThe function should return true if the three points lie on a
straight line, and false if they do not.
Example calls:
OnLineshould return true because the three points
and lie on a straight line
important:
All three function prototypes should be included in problemfunctions.h
All three functions should be implemented in problemfunctions.cpp
A makefile has been included below,
To run the tests provided, you should type the following:
make testDistance
make testOnCircle
make testOnLine
Makefile:
flags stdcWall I
problemfunctions.o : problemfunctions.cpp problemfunctions.h
g$flagsc $
testDistance : testDistance.cpp problemfunctions.o
g$flags$o $@
$@
testOnCircle : testOnCircle.cpp problemfunctions.o
g$flags$o $@
$@
testOnLine : testOnLine.cpp problemfunctions.o
g$flags$o $@
$@
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
