#1
16.03.2015 um 17:20 Uhrsystem("pause"); ist kein Standard-C++ sondern Windows-spezifisch und wird auf allen nicht-Windows-Systemen nicht kompilieren.

C++ :: Aufgabe #28 :: Lösung #1
Konsolenausgabe:
x1:1
y1:1
x2:2
y2:2
1.4142135623730951
#include <iostream> #include <math.h> using namespace std; // prototypen double hypotenuse(double ankathete, double gegenkathete); int main() { double x1 = 0.0, y1 = 0.0, x2 = 0.0, y2 = 0.0; cout << "Punkt 1:" << endl; cout << "x-position: "; cin >> x1; cout << "y-position: "; cin >> y1; cout << "Punkt 2:" << endl; cout << "x-position: "; cin >> x2; cout << "y-position: "; cin >> y2; cout << hypotenuse(x2 - x1, y2 - y1) << endl; system("pause"); return 0; } double hypotenuse(double ankathete, double gegenkathete) { return (sqrt(ankathete * ankathete + gegenkathete * gegenkathete)); }
Kommentare:
TNA
Punkte: 300
5 Lösungen
2 Kommentare
Du scheinst einen AdBlocker zu nutzen. Ich würde mich freuen, wenn du ihn auf dieser Seite deaktivierst und dich davon überzeugst, dass die Werbung hier nicht störend ist.