///Geoff Hagopian
///checking
/**
PPP4#5 Write a program that performs as a very simple calculator. Your
calculator should be able to handle the four basic math operations
— add, subtract, multiply, and divide — on two input values.
Your program should prompt the user to enter three arguments:
two double values and a character to represent an operation.
If the entry arguments are 35.6, 24.1, and '+', the program
output should be
The sum of 35.6 and 24.1 is 59.7.
In Chapter 6 we look at a much more sophisticated simple calculator.
**/
#include "std_lib_facilities.h"
//#include <cstdlib>
//#include <ctime>



int main() {
    double oper1{0}, oper2{0};
    char operation{'+'};
    cout << "\nEnter two doubles and an operation to perform on them:\n";
    while(cin >> oper1) {
        cin >> oper2 >> operation;
        switch(operation) {
        case '+':
            cout << "\nThe sum of " << oper1 << " and "
                 << oper2 << " = " << oper1+oper2 <<endl;
            break;
        case '-':
            cout << "\nThe difference of " << oper1 << " and "
                 << oper2 << " = " << oper1-oper2<<endl;
            break;
        case '*':
            cout << "\nThe product of " << oper1 << " and "
                 << oper2 << " = " << oper1*oper2<<endl;
            break;
        case '/':
            if(oper2==0) error("NAN");
            cout << "\nThe quotient of " << oper1 << " and "
                 << oper2 << " = " << oper1/oper2<<endl;
        default:
            cout << "I don't know the operation " << operation;
        }
        cout << "\nEnter two doubles and an operation to perform on them:\n";
    }
}
