home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-08 | 721 b | 37 lines | [TEXT/KAHL] |
- #include <math.h>
-
- #include <iostream.h>
-
- #include "continued_fraction.h"
-
- void main()
- {
- Boolean done = false;
-
- while( !done)
- {
- long double input;
- cout << "\nGive a number and the maximum relative error wished for.\n"
- "Example: '3.1415927 0.0001'\n"
- "Input a non-positive number to exit the program\n";
- cin >> input;
- if( input <= 0.0)
- {
- done = true;
- } else {
- long double error;
- cin >> error;
- continued_fraction the_fraction( input);
-
- long double current_error;
- int step_taken;
- do
- {
- step_taken = the_fraction.step();
- current_error = the_fraction.get_relerror();
- cout << the_fraction << '\n';
- } while( (current_error > error) && (step_taken != 0));
- }
- }
- }
-