-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path3. Simple Object.cpp
40 lines (36 loc) · 983 Bytes
/
3. Simple Object.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
3. Write a C++ program for drawing a simple
object.
*/
#include<graphics.h>
#include<conio.h>
#include<stdio.h>
void main()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"C:\\turboc3\\bgi");
line(100,100,150,50); // two lines forming the
line(150,50,200,100); // triangle shape
line(150,50,350,50); // lines forming the roof
line(350,50,400,100);
setfillstyle(SOLID_FILL,RED);
rectangle(100,100,200,200); // first rectangle
floodfill(101,199,WHITE);
setfillstyle(SOLID_FILL,BLUE);
rectangle(200,100,400,200); // second rectangle
floodfill(201,199,WHITE);
setfillstyle(LINE_FILL,GREEN);
rectangle(130,130,170,200); // door
floodfill(131,169,WHITE);
setfillstyle(LINE_FILL,YELLOW);
rectangle(250,120,350,180); // window
floodfill(251,179,WHITE);
setfillstyle(LINE_FILL,RED); // filling the
floodfill(149,99,WHITE); // colour in the
// triangle shape
setfillstyle(LINE_FILL,BLUE); // filling the
floodfill(201,99,WHITE); // colour in the
// roof
getch();
closegraph();
}