Navigation Menu

Drawing Lines using Graphics

Drawing lines in c++ include the usage of <graphics.h> header file in the file.
Line() method  gives the fascility to draw the various lines on command line based on user input.

Syntax: line(x1 ,y1 ,x2 ,y2);


Theses coordinates are calculated based on centroid point given by the user.


Example to draw a line using graph in c++.

Program:



Output:



Example to draw a circle using graph.

Program:



Output:



Example to draw a various shapes based on user input using graph.

Program:



Output:























0 comments: