answersLogoWhite

0


Best Answer

its very easy just include the graphics directory in your program...

out put a dot on the screen.... in loop like..

Horizontal line from point A(x1,y1) B(x2,y2) start to out put the point from x1,y1 and then evry next loop keep y1 the same and increment x1 by 1.

Thanks

There is one more function in graphic library of C++, that is line().

It has four arguments of int type.

line(starting x coordinate, starting y coordinate, end x coordinate, end y coordinate);

setlinestyle() and setlinecolor() can be used for different line colors and line styles.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

8y ago

Use a continuous set of underscores? Something like this: ____________. Try that in your printf. If you use dashes, you will probably see spaces in between, but not with underscores. ( -------------- Vs. ________________ )

This answer is:
User Avatar

User Avatar

Wiki User

18y ago

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)

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

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.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

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.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you draw a line using C graphics?
Write your answer...
Submit
Still have questions?
magnify glass
imp
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.


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.


How do you draw pie slice in c graphics?

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


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

the diagram shows that u cant because that a half turn


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 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 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.


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 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 implement a program to display the Indian flag with colors using c graphics?

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