Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double abstand(double x1, double y1, double x2, double y2);
- int main()
- {
- double a1;
- double b1;
- double a2;
- double b2;
- cout << "Punkt 1 eingeben" << endl;
- cin >> a1;
- cin >> b1;
- cout << "Punkt 2 eingeben" << endl;
- cin >> a2;
- cin >> b2;
- cout << "Die Strecke zwischen Punkt1 und Punkt2 ist "<< abstand(a1,b1,a2,b2) << " Einheiten lang." << endl;
- }
- double abstand(double x1, double y1, double x2, double y2)
- {
- // Aufgabe 2.
- // Distanz zwischen P1 und P2
- double Distanz;
- Distanz = sqrt(pow((x2 - x1),2.)+pow((y2- y1),2.));
- return Distanz;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement