It's just a mismatch between the character encoding used in your executable, and the one used in the console window.
You can change the console window's character encoding via the chcp
command.
You can issue that manually or e.g. in your program:
system( "chcp 1252 >nul" );
To avoid most of the encoding issues and handle international characters in general, you can use Unicode i/o.
However, the C++ standard library's support is next to non-existent, which means using platform-specific functionality, and secondly, the console windows are essentially limited to the Basic Multilingual Plane of Unicode, corresponding to original 16-bit Unicode, because of the original API design.
In practice these issues, and others, mean that there's a difference between beginner's exploratory code, and professional portable code.
You may find the following useful: (How can I make Unicode iostream i/o work in both Windows and Unix-land?)