//*********************************************************************** // Float_error.h // // this is program experiments with floating point computations and // the limitations of the digital representations of floating point // numbers. // //*********************************************************************** // INPUTS: an initial floating point value in input from the keyboard // // OUTPUTS: the computational results are displayed on the screen // //*********************************************************************** // WARNING: none // //*********************************************************************** // IMPLEMENTATION NOTE: none // //*********************************************************************** // created by: j. aleshunas // created on: 26 may 04 // modified on: 26 may 04 // // © 2004 John Aleshunas // //*********************************************************************** #include using namespace std; //*********************************************************************** // class Float_store declaration //*********************************************************************** class Float_store { // private class variables float fInital_value; // storage for the initial numeric value float fWorking_value; // storage for the results of a computation // private methods public: // public methods Float_store(float fValue); // class constructor void Multiply(void); void Divide(void); float Display_value(void); }; // class Float_store //*********************************************************************** // class Float_store method declarations //*********************************************************************** // private class method //*********************************************************************** // the class constructor Float_store::Float_store(float fValue){ // set the initial value of the floating point number fInital_value = fValue; fWorking_value = fValue; return; } // Float_store::Float_store(float fValue) //*********************************************************************** void Float_store::Multiply(void){ fWorking_value = fWorking_value * fInital_value; return; } // Float_store::Multiply(void) //*********************************************************************** void Float_store::Divide(void){ fWorking_value = fWorking_value / fInital_value; return; } // Float_store::Divide(void) //*********************************************************************** float Float_store::Display_value(void){ return fWorking_value; } // Float_store::Display_value(void) //***********************************************************************