Как вы исправляете ошибки E0167 и C2664 при рисовании линий с graphics.h в Visual Code 2019? - PullRequest
0 голосов
/ 19 октября 2019

Когда я пытаюсь рисовать линии в Visual Studio 2019 с graphics.h, я продолжаю получать 2 типа ошибок.

Это пример, который я пытаюсь заставить работать на моем компиляторе с geeksforgeeks.org.

Ошибки

E0167 - аргумент типа "const char *" несовместим с параметром ложь 2 типа "char *" - строка 17

и

C2664 - 'void initgraph (int *, int *, char *)';невозможно преобразовать аргумент 3 из 'const char [1] в' char * '- строка 17

Мой код:

'''// C++ Implementation for drawing line 
#include <graphics.h> 

// driver code 
int main()
{
    // gm is Graphics mode which is a computer display 
    // mode that generates image using pixels. 
    // DETECT is a macro defined in "graphics.h" header file 
    int gd = DETECT, gm;

    // initgraph initializes the graphics system 
    // by loading a graphics driver from disk 
    initgraph(&gd, &gm, "");

    // line for x1, y1, x2, y2 
    line(150, 150, 450, 150);

    // line for x1, y1, x2, y2 
    line(150, 200, 450, 200);

    // line for x1, y1, x2, y2 
    line(150, 250, 450, 250);

    getch();

     // closegraph function closes the graphics 
    // mode and deallocates all memory allocated 
    // by graphics system . 
    closegraph();
}'''
...