Most likely you need to change the code page to 1252. The code page controls which set of glyphs are displayed for each character.
The following sample program changes to code page 1252 and then displays the character set. I think the code page can also be set via a console command, maybe in a .bat file.
The standard, portable C++ approach is to use wide streams, since '£' is not an ASCII character:
1 2 3 4 5 6 7 8
#include <iostream>
#include <locale>
int main()
{
std::locale::global(std::locale("en_US.utf8")); // any unicode works
std::wcout.imbue(std::locale());
std::wcout << L"Total Sales for book £" << 10 << '\n';
}
Windows has no standard Unicode support, so you have to resort to OS-specific API calls to get anything done. I would avoid touching console codepages for being too incompatible with the rest of the world. You can actually use standard C++, only the magic words to turn on wcout are different:
1 2 3 4 5 6 7 8 9
#include <iostream>
#include <fcntl.h>
#include <io.h>
usingnamespace std;
int main()
{
_setmode(_fileno(stdout), _O_WTEXT);
std::wcout << L"Total Sales for book £" << 10 << '\n';
}
Just some comments not related to your problem - just trying to provide a little education to show a better way of doing things:
Your functions should be part of the book class. Ideally you should have the class declaration in a .h file with the function definitions in a .cpp file
I personally hate (just ugly with the &&'s and !='s, and not scalable for other things) constructs like line 33 - much better to make use of the toupper function to avoid testing twice.