Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
624 B
21
Indexable
Never
#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)
{
	int d;
	d = sqrt(pow(x2 - x1, 2.0) + pow(y2 - y1, 2.0));
	return d;
}
int main()
{
	double x1, x2, y1, y2;
	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);
		return 0;
}