SHARE
TWEET

Untitled

a guest Feb 21st, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class PrecisionOp : public Op{
  2.         public:
  3.                 int decPlaces; //variable determines how many decimal places the precision will be set to
  4.                 double number;
  5.                
  6.                 PrecisionOp(int decPlaces, double value) : decPlaces(decPlaces), Op(value){}
  7.  
  8.                 string stringify(){//functions turns value into a string then returns it
  9.                         stringstream sstream;
  10.                         sstream << fixed << setprecision(decPlaces) << Op::value;
  11.                         return sstream.str();   //might need to do to_string
  12.                 }
  13. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top