How do I write text with symbols in the Visual Studio console?

The c++programming language. You need to insert the label

        cout << "███████████████████████████████████" << endl; 
        cout << "█─███─█───█─███────█────█─███─█───█" << endl;
        cout << "█─███─█─███─███─██─█─██─█──█──█─███" << endl;
        cout << "█─█─█─█───█─███─████─██─█─█─█─█───█" << endl;
        cout << "█─────█─███─███─██─█─██─█─███─█─███" << endl;
        cout << "██─█─██───█───█────█────█─███─█───█" << endl;
        cout << "███████████████████████████████████" << endl;
        cout << "██████████" << endl;
        cout << "█───█────█" << endl;
        cout << "██─██─██─█" << endl;
        cout << "██─██─██─█" << endl;
        cout << "██─██─██─█" << endl;
        cout << "██─██────█" << endl;
        cout << "██████████" << endl;
        cout << "██████████████" << endl;
        cout << "█───█─██─█───█" << endl;
        cout << "██─██─██─█─███" << endl;
        cout << "██─██────█───█" << endl;
        cout << "██─██─██─█─███" << endl;
        cout << "██─██─██─█───█" << endl;
        cout << "██████████████" << endl;
        cout << "█████████████████████" << endl;
        cout << "█────█────█─███─█───█" << endl;
        cout << "█─████─██─█──█──█─███" << endl;
        cout << "█─█──█────█─█─█─█───█" << endl;
        cout << "█─██─█─██─█─███─█─███" << endl;
        cout << "█────█─██─█─███─█───█" << endl;
        cout << "█████████████████████" << endl;
Author: MSDN.WhiteKnight, 2018-06-16

1 answers

You can also display it in UTF-8 (cp65001), but this encoding is usually more problematic. It is easier to output in UTF-16, in this case, you do not have to additionally mess with the encoding of files and the console, just set the output mode of the standard stream:

#include <iostream>
#include <io.h>
#include <fcntl.h>
#include <stdio.h>

int main()
{
    ::_setmode(::_fileno(stdout), _O_U16TEXT);
    auto const & sz_message
    {
        L"███████████████████████████████████" L"\n"
        L"█─███─█───█─███────█────█─███─█───█" L"\n"
        L"█─███─█─███─███─██─█─██─█──█──█─███" L"\n"
        L"█─█─█─█───█─███─████─██─█─█─█─█───█" L"\n"
        L"█─────█─███─███─██─█─██─█─███─█─███" L"\n"
        L"██─█─██───█───█────█────█─███─█───█" L"\n"
        L"███████████████████████████████████" L"\n"
    };
    ::std::wcout << sz_message << ::std::flush;
    ::_wsystem(L"pause");
    return(0);
}

enter a description of the image here

With a pixel font of 8x12 (in this case, there will still be no anti-aliasing and line breaks):

enter a description of the image here

 7
Author: user7860670, 2018-06-16 09:35:39