-3

what does this call is it printing ASCII art and how can I know those numbers present those texts

void Menu::printLogo()
{
    unsigned char logo[] = {32,219,219,219,219,219,219,187,32,219,219,219,219,219,219,187,32,32,32,32,32,32,32,219,219,219,219,219,219,187,32,219,219,219,219,219,187,32,219,219,219,219,219,219,187,32,32,219,219,219,219,219,219,187,32,219,219,201,205,205,205,205,188,219,219,201,205,205,205,219,219,187,32,32,32,32,32,219,219,201,205,205,205,205,188,219,219,201,205,205,219,219,187,219,219,201,205,205,219,219,187,219,219,201,205,205,205,219,219,187,219,219,186,32,32,32,32,32,219,219,186,32,32,32,219,219,186,32,32,32,32,32,219,219,186,32,32,32,32,32,219,219,219,219,219,219,219,186,219,219,219,219,219,219,201,188,219,219,186,32,32,32,219,219,186,219,219,186,32,32,32,32,32,219,219,186,32,32,32,219,219,186,32,32,32,32,32,219,219,186,32,32,32,32,32,219,219,201,205,205,219,219,186,219,219,201,205,205,219,219,187,219,219,186,32,32,32,219,219,186,200,219,219,219,219,219,219,187,200,219,219,219,219,219,219,201,188,32,32,32,32,32,200,219,219,219,219,219,219,187,219,219,186,32,32,219,219,186,219,219,186,32,32,219,219,186,200,219,219,219,219,219,219,201,188,32,200,205,205,205,205,205,188,32,200,205,205,205,205,205,188,32,32,32,32,32,32,32,200,205,205,205,205,205,188,200,205,188,32,32,200,205,188,200,205,188,32,32,200,205,188,32,200,205,205,205,205,205,188,32 };

    int top = 4, left = 27;
    int num_lines = 6, num_chars = 55;

    for (int i = 0; i < num_lines; i++)
    {
        Common::gotoXY(left, i + top);

        for (int j = 0; j < num_chars; j++)
            putchar(logo[i*num_chars + j]);
    }
}

Output:

Output text

Filburt
  • 17,626
  • 12
  • 64
  • 115
  • 1
    the array `logo` contains the Ascii codes used. You can check how each code looks in an ascii table https://www.asciitable.com/ –  Apr 01 '22 at 07:53
  • 1
    The numbers over 127 are terminal-specific character codes that are interpreted as some graphical characters. The only one below 128 is 32, which is the ASCII space character. – molbdnilo Apr 01 '22 at 07:56

1 Answers1

0

What you don't understand?

Logo is an array of the chars that are composing the logo, starting from left to right.

A line is composed by num_chars = 55.

Not sure the style is the nicest but the code is not so hard. In C++20 it could be written in much more funny way:

#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{    
    vector<string> logo{
        " ▐████╗",
        "██▌╔══╝",
        "██▌║   ",
        "██▌║   ",
        "╚█████╗",
        "  ╚═══╝"
    };
    
    for(auto line : logo)
        cout << line << endl;
    
    return 0;
}

Elvis Dukaj
  • 7,142
  • 12
  • 43
  • 85