Untitled

 avatar
unknown
plain_text
3 years ago
710 B
4
Indexable
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

double oblicz_odleglosc(double x1, double x2, double y1, double y2, double * d);

int main()
{
	double x1, x2, y1, y2, d;
	cout << "Podaj wspolrzedne punktow: \n";
	cout << "Podaj x1:";
		cin >> x1;
		cout << "Podaj y1:";
		cin >> y1;
		cout << "Podaj x2:";
		cin >> x2;
		cout << "Podaj y2:";
		cin >> y2;
		cout << "Odleglosc miedzy punktami wynosi: \n" << setprecision(2) << oblicz_odleglosc (x1, x2, y1, y2, &d);
		return 0;
}

double oblicz_odleglosc(double x1, double x2, double y1, double y2, double *d)

{
	*d = sqrt(pow(x2 - x1, 2.0) + pow(y2 - y1, 2.0));
}
Editor is loading...