///Geoff Hagopian
///checking math summation formulas

#include "std_lib_facilities.h"

int main() {
    /**1. Write a program that consists of a while-loop that
    (each time around the loop) reads in two ints and then
    prints them. Exit the program when a terminating '|'
    is entered.
    2. Change the program to write out the smaller value is:
    followed by the smaller of the numbers and the larger
    value is: followed by the larger value.
    3. Augment the program so that it writes the line the
    numbers are equal (only) if they are equal.
    4. Change the program so that it uses doubles instead
    of ints.
    5. Change the program so that it writes out the numbers are
    almost equal after writing out which is the larger and the
    smaller if the two numbers differ by less than 1.0/100**/
    double x{1234},y{1234};
    cout << "\nEnter two doubles:\n";
    while(cin>>x) {
        cin >> y;
        cout << setprecision(16) << "\nYou entered "
             << x << " and " << y << endl;

        if(x<y) {
            cout << setprecision(16) << "\nThe larger is " << y
                 << " and the smaller is " << x;
            if(abs((y-x)/x)<0.01) cout << "\nThey're pretty close!";
        }
        else if(x>y) {
            cout << setprecision(16) << "\nThe larger is " << x
                 << " and the smaller is " << y;
            if(abs((x-y)/y)<0.01) cout << "\nThey're pretty close!";
        }
        else
            cout << setprecision(16) << x << " is equal to " << y;
        cout << "\nEnter two doubles:\n";

    }
}
