DEV C Question help it is MUST of using programmaing languag

[DEV C++] Question help, it is MUST of using programmaing language of DEV C++

If you are in a city and have to walk from when you are, having planar coordinates (0, 0), to a destination having planar coordinates (x, y), then there are two ways of computing the distance you have to travel. One is called the euclidean distance, r1 = Squareroot x^2 + y^2 Note that this distance might require you to cut across lawns and through buildings. There is another way to measure distance called the taxi-cab distance, r2 = |x| + |y| which is the distance a taxi-cab would have to travel along the city blocks. Write a program which reads the destination coordinates, (x, y), and calls a single function, distance, which computes both the euclidean distance and the taxi-cab distance. The main program (not the function) must then print both distances to the screen. Your program\'s input and output should look like: Enter x and y: 3 4 The destination coordinates are (3.0000, 4.0000) The euclidean distance is 5.0000 The taxicab distance is 7.0000 For marking purposes run your program twice using destinations: (2, 4) and (-3, 4).

Solution

Hi ,

Provided answer.

C++ code

#include<stdio.h>
#include<conio.h>
#include <iostream>

using namespace std;
//main function.
int main(){
//defining variables x and y.
int cordX,cordY;
//Here prompt users for X and Y values.
//her endl means end of line
std::cout<<\"Enter x and Y\"<<endl;;
std::cin >> x >> y;
//Defining euclidian distance variable.
double euclidistance=0;
//Defining taxi-cab-distance variable.
double taxi-cab-distance=0;

}

[DEV C++] Question help, it is MUST of using programmaing language of DEV C++ If you are in a city and have to walk from when you are, having planar coordinates

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site