When I try to draw lines in Visual Studio 2019 with graphics.h I keep getting 2 types of errors.
This is an example I'm trying to get to work on my compiler from geeksforgeeks.org
Errors
E0167 - argument of type "const char*" is incompatible with lies 2 parameter of type "char*" - Line 17
and
C2664 - 'void initgraph(int*,int*,char*)'; cannot convert argument 3 from 'const char[1] to 'char*' - Line 17
My code:
'''// 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();
}'''