#includeint main(){ int gd = DETECT, gm; initgraph(&gd, &gm, ""); int x1 = 100, y1 = 100, x2 = 200, y2 = 200; drawLine(x1, y1, x2, y2); getch(); closegraph(); }
#includeint main(){ int gd = DETECT, gm; initgraph(&gd, &gm, ""); int points[] = {100, 100, 200, 200, 300, 300, 400, 400, 500, 500}; int num_points = 5; for(int i=0; i In this example, we draw multiple lines between points on the screen by passing the coordinates of each point in an array. We then loop through the array and draw each line between adjacent points. Package/library: The graphics library used in these examples is likely to be the BGI (Borland Graphics Interface) library which is commonly used for graphics programming in C++. It is typically included with compilers such as Borland C++ and Turbo C++.