answersLogoWhite

0


Best Answer

Hi, To draw a line in C, follow steps given below- 1. Load graphics Driver using the syntax: int gd,gm; initgraph(&gd,&gm,""); In this initgraph is a function defined in graphics.h header file. In this function gd is for graphics driver and gm is for graphics mode.Third argument is path to your .bgi file. You are preferred to keep your all .bgi and .chr files in bin folder so no need to give path for these things. .BGI files are graphics adapter so for good graphics you should use enhanced adapter you can take more details about these from help of turbo C++ IDE. Well, you can use EGAVGA.bgi. 2.Now You can use any graphics function like line, circle, rectangle etc. For drawing a line you can use following syntax: line(100,100,300,100); These are initial point and final points of a line respectively. 3.Finally you should close the graphics environment by using closegraph(); ,so control will return back to the text mode. It is not mandatory , but it is a good practice. Thanx n Regards Ajay vijaywargiya(SE) BMC s/w pune(India)

User Avatar

Wiki User

โˆ™ 2006-01-18 09:30:50
This answer is:
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
User Avatar
Study guides
๐Ÿ““
See all Study Guides
โœ๏ธ
Create a Study Guide

Add your answer:

Earn +20 pts
Q: How do you draw a line using C graphics?
Write your answer...
Submit
Related questions

How do you draw Logic Gates in C language?

The C language is not a graphics language and you cannot draw logic gates using it. C is a programming language, and it is possible to use a graphics library to do so, but you did not specify which library you were using. Please restate the question.


Write a C program to draw a sphere in computer graphics?

Write a C program to draw a sphere in computer graphics?


How do you draw pie slice in c graphics?

using pie slice function akwinder can draw monkey which exactly looks like her.


How do you draw a line using c garphics best site?

I presume you need a graphics package that you can use with C. Do some google searches (and remember to specify your OS) and pick the one you like the best.


To draw a circle and show its movements using c plus plus graphics?

C++ has no built-in graphics methods. Graphics are platform-specific, but C++ is a generic language. To use graphics you need a graphics library and API that are specific to your platform and hardware. The code you use will therefore be specific to that library.


How do you draw a line in c plus plus?

Since all graphics are platform-specific, there are no built-in, generic graphics routines, including line drawing. To draw any graphics you will need a suitable API for your platform and hardware, thus the actual code will vary according to which system you are targeting.


How do you draw a circle using C or C plus plus?

You cannot -- not with a generic C or C++ implementation. Both are designed to be as generic as possible, but graphics are platform-specific. For graphics output, you therefore need a suitable graphics library and API for your specific platform and hardware.


Program a line roating about xy plane using C plus plus programming?

C++ has no built-in graphics methods, including line drawing. Graphics is platform-specific and, as such, requires a graphics API and library specific to your platform and hardware. As a result, there is no generic, one-size-fits-all C++ code for drawing graphics of any kind.


How do you draw a sphere in computer graphics using C plus plus?

C++ is a generic, cross-platform language, but graphics are platform-dependant. thus C++ has no built-in methods for graphics output. To draw graphics in C++ you need a low-level API and library specific to the platform and hardware you intend to target. Some libraries are highly abstract and therefore support cross-platform development, but most are platform-specific. Consult the documentation that came with your library.


C program to Draw a line chart?

draw a line chart.


How to Draw a rotating wheel Using c graphics programme code?

the diagram shows that u cant because that a half turn


What are all the built in functions iin graphics using c?

Graphics is not part of the standard C-library.


How do you draw circle in c plus plus?

You cannot draw any graphics in standard C++. For graphics output you need an appropriate API that supports your platform and hardware. Since this is platform-specific, it is not part of the standard.


How can you code a curve in c plus plus?

If you mean how do you draw a curve in C++, you can't. C++ does not have any built-in graphics support of any kind. All graphics are platform-specific so, to be able to draw graphics, you need a graphics API and library suitable for your platform and hardware. As a result, the code you use will not be portable. In most graphics libraries you will draw curves as a series of arcs, so you want to look up the arc() function in your library documentation.


How do you draw a line using c plus plus without built-in functions?

There are no built-in functions that can draw lines since C++ is a generic language and graphics are platform-dependent. Even the standard library does not provide any line drawing methods aside from printing ASCII line-drawing characters on the console. Even so, consoles are also platform-dependent; there are no generic methods of printing a specific character at a specific position. To draw lines -- that is to say a straight line between two points within a viewport -- you will need a graphics library that supports your platform. OpenGL is your best option as it provides a generic interface.


How do you implement a program to display the Indian flag with colors using c graphics?

ANSI/ISO C does not and never has done graphics.


How do you do a 3D character like A using c plus plus 2010?

C++ is a generic, cross-platform programming language, while 3D graphics are platform-specific. To draw graphics of any kind you need a low-level API and library specific to your platform and hardware.


How you draw a circle in C programming?

C does not provide any native support for graphics manipulation. C is a general-purpose language, not a system-specific language. To add graphics support you must link to a graphics library. Generic libraries such as OpenGL are recommended.


How do you draw in Dev c plus plus?

Download and install the WinBGIM Devpack. Once installed, you can include graphics.h to draw graphics.


How do you draw a concentric circle using C or C Plus Plus with the built-in graphic function?

You don't: the C and C++ languages do not have any built-in graphics tool. Further, it is impossible to draw a concentric circle. Multiple circles are concentric when they share the same center.In C or C++, graphic functions such as the drawing of lines, rectangles or circles are provided through third party libraries, or through wrappers which provide access to the operating system's graphics functions.


What is the built in function to draw lines in Visual C plus plus?

C++ has no built-in function to draw lines, nor indeed to perform any type of graphics output. The standard library is designed to be as generic as possible, and is therefore capable of supporting all platforms using text output only. Graphics output is obviously possible, but it is platform-specific so you will need a graphics API that provides functions that are specific to your operating system and/or hardware.


What is function in turbo c?

i want a coding of a program of a calculator using graphics in c language??


How would you draw a perpendicular line?

Using a compass and ruler: # At the point you want the perpendicular line to cross, place a dot. Label it A. # Draw a circle centred at A with a radius of about an inch (two-three centimetres). Label the points it intersects the original line as B and C. # Construct two circles centred at B and C, large enough that they almost reach the other point and have the same size. Label the points they intersect at as D and E. # Draw a straight line between E and D. This line is the perpendicular line. This method can also be used to draw a perpendicular bisector, if the ends of the line you wish to bisect are labelled as points B and C.


How do you write 5.267?

first you draw a horizontal line, the on the left side of the line draw a line going down, then at the end of the line draw a curve which looks like a inverted c. Then you have 5 then put a dot on the bottom side of the 5 then draw a curve which looks like and inverted c, then on the bottom draw a line which goes horizontally, now you have 5.2 then you make a curve which looks like a sphere but the end of the line touches the middle of the line, forming a loop. Now you have 5.26 then draw a line horizontally, then at the right side draw a line which goes diagonally. Now you have wrote 5.267


Can you plot a graph using C graphics?

C has no native support for graphics. You would either have to use your local APIs or use an external library (ex: OpenGL).