+ 3

How can I include graphics in my C ++ programs?

:(

24th Jun 2020, 4:22 AM
roxana pascacio
roxana pascacio - avatar
12 Answers
+ 8
Here is example of graphics program u can see. If u want to use graphics in program first u need graphics.h header file then u have to write graphics driver gdriver ,gmode . hope this will help you. #include<graphics.h> #include<stdio.h> #include<conio.h> void main(void) { int gdriver = DETECT, gmode; int x1 = 200, y1 = 200; int x2 = 300, y2 = 300; clrscr(); initgraph(&gdriver, &gmode, "c:\\turboc3\\bgi"); line(x1, y1, x2, y2); getch(); closegraph(); }
25th Jun 2020, 9:14 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 7
Here, it doesn't work
24th Jun 2020, 4:24 AM
ÃKR
ÃKR - avatar
+ 7
If u will increase first parmtr then line will start from left , second para.. for give space from top to down , and last para for end of line 3rd to change angle
25th Jun 2020, 11:36 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 7
Mouli 🌸 u can draw arc through arc function and u can also use ellipse decrease 5and 6th parameter for half shape For arc this is syntex arc(x, y, start_angle, end_angle, radius);   
25th Jun 2020, 11:40 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 7
Mouli 🌸 Write any functions name . Like line () and first put all values 0,0,0,0 line(10,0,0,0); and change all values one by one after practice u can find exact place where u want to draw  line from a point(x1,y1) to point(x2,y2) i.e. (x1,y1) and (x2,y2) are end points of the line
25th Jun 2020, 11:51 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 6
Mouli 🌸 line function take four parameters . Coordinate are working as same as when you plot any graph in graph paper.
25th Jun 2020, 11:27 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 6
Mouli 🌸 if u waana line from one end to last end u can write like this line(10,230,200,500);
25th Jun 2020, 11:28 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 6
Mouli 🌸 arc is use to draw ellipse shape it take 3parameter
25th Jun 2020, 11:30 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
yes, but in compilers for pc
24th Jun 2020, 4:26 AM
roxana pascacio
roxana pascacio - avatar
+ 2
Thank you
24th Jun 2020, 4:34 AM
roxana pascacio
roxana pascacio - avatar
0
You can include a library function for graphics i.e, #include<graphic.h> in Turbo C++
25th Jun 2020, 2:43 PM
Újjwál