Hey guys, i was bored so made a money converter, nothing is wrong with errors etc in the code but when i run my program, the pound sign is not valid, it comes up as a u with a accent on top, please help.

#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
    unsigned int convertMoney;
    char moneySymbol;
    
    cout << "Enter whether you would like convert from £ / $ : ";
    cin  >> moneySymbol;
    
    switch (moneySymbol)
    {
           case '$':
           cout << endl << "Enter ammount to convert :";
           cin  >> convertMoney;
           cout << "$" << convertMoney << " = £" << (convertMoney * 0.508233381);
           break;
           
           case '£':
           cout << endl << "Enter ammount to convert :";
           cin  >> convertMoney;
           cout << "£" << convertMoney << " = $" << (convertMoney * 1.9676);
           break;
    }
    getch();
}

EDIT : I googled it and found this website, http://www.fileformat.info/info/unicode/char/00a3/index.htm
I looked and it told me to enter "\u00A3" for the pound sign, i did that put it came up with another symbol PLEASE HELP

Recommended Answers

All 5 Replies

Well your use of conio.h suggests a fossil compiler.
Since £ wasn't in the original 7-bit ASCII character set, mileage varies as to what you'll see.

>> fossil compiler.
I'm using dev-c++, just using that for getch();

So is there noway of getting £ into my program?

int main()
{
    cout << (int)'£' << "\n";
    return 0;
}

The output of the above on my computer is -93. You'll have to change the local setting if you want to print that character from -93 because it doesn't print that with the standard american local setting.

int main()
{
    cout << (int)'£' << "\n";
    return 0;
}

The output of the above on my computer is -93. You'll have to change the local setting if you want to print that character from -93 because it doesn't print that with the standard American local setting.

My output is also -93, could you please show me how to change etc, many thanks

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.