All pastes #799514 Raw Edit

Heron-Vefahren

public cpp v1 · immutable
#799514 ·published 2007-11-27 18:21 UTC
rendered paste body
#include <iostream>using namespace std;int main (){    double R, X=1, Y, A=1, D, H;        cout << endl;    cout << "Heron-Verfahren" << endl << endl;    cout << "Gib den Radikanten ein!" << endl;    cin >> R;    Y=R;    H=X-Y;    if (H>=0)       D=H;    if (H<0)       D=-H;     while ( D>0,000000005 )    {          X=1.0/2*(X+(R/X));          Y=R/X;          A=A+1;          H=X-Y;          if (H>=0)             D=H;          if (H<0)             D=-H;          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;}