### Create an Account

Home / Questions / Prompt the user for two points (x1, y1), (y1, y2). Write a function that calculates the distance bet

# Prompt the user for two points (x1, y1), (y1, y2). Write a function that calculates the distance bet

Prompt the user for two points (x1, y1), (y1, y2). Write a function that calculates the distance between the points. For a refresher on how to calculate the distance between two points, click here: http://www.mathwarehouse.com/algebra/distance_formula/index.php

#include // YOUR CODE GOES BELOW HERE

// TO HERE

// DO NOT CHANGE ANYTHING BELOW HERE

int main() {

double x1, y1, x2, y2;

cout

cin >> x1;

cout

cout

cin >> y1;

cout

cout

cin >> x2;    cout

cout

cin >> y2;

cout

cout

cout

return 0; }

Sample run #1:

Enter x1: -5

Enter y1: 8

Enter x2: 0

Enter y2: -4

The distance is 13

MORE 

Sample run #2:

Enter x1: 12.5

Enter y1: 18.7

Enter x2: -13.9

Enter y2: -29.5

The distance is 54.9563

Apr 02 2020 View more View Less Subscribe To Get Solution