Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PrecisionOp : public Op{
- public:
- int decPlaces; //variable determines how many decimal places the precision will be set to
- double number;
- PrecisionOp(int decPlaces, double value) : decPlaces(decPlaces), Op(value){}
- string stringify(){//functions turns value into a string then returns it
- stringstream sstream;
- sstream << fixed << setprecision(decPlaces) << Op::value;
- return sstream.str(); //might need to do to_string
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement