Last night I got so fustrated trying to do something really simple in c++. I needed to represent a GBP £ sign in a c++ windows console application. My smug friend using linux terminal and GCC assured me that the pound sign did not keep him up last night, but for me compiling away on MSBUILD it was a nightmare. Something so simple. yet after trying EVERY POSSIBLE mixture of search terms, google provided me with nothing! For once google had failed me! It did however suggest escape character methods and all sorts of other fruitfull options but none that worked. When outputing a £ to the command line I got “u”. Not much use when your trying to represent a price in GBP! It turns out that microsoft, being american, does not naturally support the character and the following is required to achieve such a simple thing.
//show pound sign in c++
cout << “This will cost ” <<pound << “5.00” ;
Why am I blogging this?? In the hope that after this blog post gets indexed by google, the many others who appear on forums searching for this solution, and those who will come across it in the future, will find this and get an early night! Unlike myself 😛