SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 3 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 13 Nov 2017 My Price 10.00

Prompt the user for two points (x1, y1), (y1, y2).

Could you please help me with this C++ question? Please use basic c++ code.

 

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

Start with this code:

#include <iostream>

// YOUR CODE GOES BELOW HERE

// TO HERE

// DO NOT CHANGE ANYTHING BELOW HERE

int main() {

double x1, y1, x2, y2;

cout << "Enter x1: ";

cin >> x1;

cout << x1 << endl;

cout << "Enter y1: ";

cin >> y1;

cout << y1 << endl;

cout << "Enter x2: ";

cin >> x2;

cout << x2 << endl;

cout << "Enter y2: ";

cin >> y2;

cout << y2 << endl;

cout << "The distance is ";

cout << distance(x1, y1, x2, y2) << endl;

return 0;

}

 

 

 

 

 

Sample run #1:

Enter x1: -5

Enter y1: 8

Enter x2: 0

Enter y2: -4

The distance is 13

 

 

 

Sample run #2:

Enter x1: 12.5

Enter y1: 18.7

Enter x2: -13.9

Enter y2: -29.5

The distance is 54.9563

Attachments:

Answers

(5)
Status NEW Posted 13 Nov 2017 02:11 PM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)