dimanche 1 mars 2020

Only two decimal places needed in to_string(price); written in c++11

I am converting price to a string and this needs to output two decimal places for to_string(). How do I do that?

string Antique::toString()
{
    string info = name + ": " + " $" + to_string(price); 

    return info;
}

Aucun commentaire:

Enregistrer un commentaire