- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Draw a line in C++ graphics
In this tutorial, we will be discussing a program to draw a line in C++ graphics.
To implement different shapes and sizes, animations, graphics.h library is used in C++.
Example
#include <graphics.h> int main(){ int gd = DETECT, gm; initgraph(&gd, &gm, ""); line(150, 150, 450, 150); line(150, 200, 450, 200); line(150, 250, 450, 250); getch(); closegraph(); return 0; }
Output
- Related Articles
- How can we draw a rounded rectangle using the Graphics object in Java?
- How to apply a gamma correction to a Graphics Draw (GD) image in PHP?
- bar() function in C graphics
- How to draw a line in OpenCV using C++?
- Draw a line, say $AB$, take a point $C$ outside it. Through $C$, draw a line parallel to $AB$ using ruler and compasses only.
- How to draw a line in Android?
- Point Clipping Algorithm in Computer Graphics in C++
- Flood fill algorithm using C graphics
- Draw an angle $ABC =70^o$. Through point $C$ draw a line parallel to $AB$.
- Draw line $l$. Take any point $P$ on the line. Using a set square, draw a line perpendicular to line $l$ at the point $P$.
- Draw a line segment $AB$ of length $5.8 cm$. Draw the perpendicular bisector of this line segment.
- How to draw a line with lineTo() in HTML5?
- How to draw a line in OpenCV using Java?
- How to draw a line in Android using Kotlin?
- Draw a line on an image using OpenCV

Advertisements