///Geoff Hagopian
///checking math summation formulas

#include "std_lib_facilities.h"

int main() {
    /**6. Now change the body of the loop so that it reads just
    one double each time around. Define two variables to keep track
    of which is the smallest and which is the largest value you have
    seen so far. Each time through the loop write out the value
    entered. If it’s the smallest so far, write the smallest so far
    after the number. If it is the largest so far, write the largest
    so far after the number.**/
    double x, minD, maxD;
    vector<double> vdouble;
    cout << "\nEnter a double:\n";
    cin>>x;
    vdouble.push_back(x);
    minD = x;
    maxD = x;
    cout << "\nEnter a double:\n";
    while(cin>>x) {
        vdouble.push_back(x);
        for(int i=0;i<vdouble.size()-1;i++) {
            if(x>maxD) maxD = x;
            if(x<minD) minD = x;
        }
        cout << setprecision(16) << "\nYou entered "
             << x;
        if(x==maxD) cout << ", the largest so far.\n";
        else if(x==minD) cout << ", the smallest so far.\n";
        else cout << endl;
    }
}
