Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given two points (x1, y1) and (x2, y2), the distance between this points is defined as the square root of (x2-x1)*2+ (y2-y1)2. Writea function distance(x1,
Given two points (x1, y1) and (x2, y2), the distance between this points is defined as the square root of (x2-x1)*2+ (y2-y1)"2. Writea function distance(x1, y1, x2, y2) that returns the distance between the given points. The main function is written for you; your job is to write the distance function. Start by reviewing the code for "main.cpp" which is visible in the editor pane note that this code is read-only (you cannot modify it). Notice that the main0 program inputs two points (x1, y1) and (x2, y2), calls distance to compute the distance, and then outputs this result. Above the editor pane you'll see the textCurrent file: main.cpp", with a little drop-down arrow to the right. Click the drop-down and select functions.cpp. Then, to avoid a bug in some web browsers, please immediately click the link "Load default template.... You only need to do this once, the first time you view the file. Implement the function. To test your work in Develop mode, supply two points in the following format: 0, 0 10,10 Each point is on a line by itself, with no spaces. In this case the output should be Distance: 14.1421 When you are ready to submit for testing, switch to Submit mode and submit for grading. You have unlimited submissions. LAB ACTIVITY 6.21.1: HW11-01: Distance between two points 0/100 Current file: functions.cpp Load default template... 1 functions.cpp 3 #include 4 #include 5 #include 7 using namespace std; 9 double distanceintx int yl, int x2, int y2) 10 11 12 13 return 0.0 Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the Develop mode Submit mode
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started