Member Avatar for johny112

Hi all,
I have written a programme, but when it prints the results , it doesnt print £ sign

cout <<"Salary is £ "<< salary_without_overtime<<endl;

Instead it prints u="U" with a funny bar on top.

Now im very new to c++ but i do know basics, can someone please tell me how to print the outcome with £ sign.
thanx

>it doesnt print £ sign
Your text editor is using Unicode, but the console is using extended ASCII. Try this instead:

cout<<"Salary is \x9C "<< salary_without_overtime <<endl;
Member Avatar for johny112

>it doesnt print £ sign
Your text editor is using Unicode, but the console is using extended ASCII. Try this instead:

cout<<"Salary is \x9C "<< salary_without_overtime <<endl;

that code doesnt work.
any more help?

>that code doesnt work.
How didn't it work? It probably printed a character, so maybe you should select what actually gets printed and paste it here. "It doesn't work" is about as useless as me telling you that "it works for me".

Member Avatar for iamthwee

try cout << (char)156;

>try (char)156
Try converting 156 to hexadecimal before suggesting the exact same solution next time. :icon_rolleyes:

Member Avatar for iamthwee

lol, I don't normally take notice of your posts. Sorrie. :)

>I don't normally take notice of your posts
That's odd. Usually people take notice. They say "Oh, Narue posted so the problem is solved way better than I could manage. I won't even bother replying now". ;)

Member Avatar for iamthwee

That's cute you think of yourself that way. I hope your family share the same sentiments, but they probably think you're just mad? Am I right or am I right :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.