How can I delete decimal points from a 'double' type to later be displayed as a currency?
I cannot use setprecision(2) here because I am not writing out the transaction to the console yet.
Yes you can use it. Just use std::ostringstream
:
std::string Transaction::toString() {
std::ostringstream fullString;
fullstring << "-- " << desc << ": -\x9c" << std::setprecision(2) << value << " on " << timestamp;
return fullString.str();
}
If you use C++20 or later you can use std::format