convert string to Currency

How to convert string to currency type.
Not sure what you mean by currency type.
Do you mean adding a currency's symbol to a string?

if you have a string with "56.09" in it, then you make it "£56.09"?

Explain more about what you mean by that.

You may need to format the string.
Please do not post duplicates.
Dear Aceix,
thanx for your valuable reply. yeah i want to do exactly as according to your example. how it is possible. thanx in advance.
std::string str1 = "56.09";
std::string str2 = "£" + str1;
std::cout << str2 << std::endl; // prints £56.09 
Last edited on
if your compiler is sufficiently new, you can use std::put_money from <iomanip>
Last edited on
Topic archived. No new replies allowed.