All pastes #799427 Raw Edit

Heron-Vefahren

public cpp v1 · immutable
#799427 ·published 2007-11-27 17:07 UTC
rendered paste body
#include <iostream>using namespace std;int main (){    double R, X, Y, A, D, H;        cout << endl;    cout << "Heron-Verfahren" << endl << endl;    cout << "Gib den Radikanten ein!" << endl;    cin >> R;    X=1;    Y=R;    A=1;    H=X-Y;    if (H>=0)       D=H;    if (H<0)       D=-H;         while ( D>0,000005 )    {          X=1.0/2*(X+(R/X));          Y=R/X;          A=A+1;          printf ("%.10f | %.10f", X, Y);           cout << endl;          system("Pause");    }    cout << "Im " << A << ". Schritt habe ich herausgefunden, dass die Wurzel von " << R << " " << X << " ist." << endl;        system("Pause");    return 0;}