Draw a triangle in C++ graphics
To run the program we have to include the below header file:
Approach: The idea is to create a triangle with the help of several lines. We will draw a line in graphics by passing 4 numbers to line() function as:
line(a, b, c, d)
The above function will draw a line from coordinates (a, b) to (c, d) in the output window.
Below is the implementation of the above approach: