Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  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. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement