BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/index.php)
-   Object Oriented Programming (http://bzupages.com/forumdisplay.php?f=322)
-   -   Program to draw 2 rectangles and fill 1 of them (http://bzupages.com/showthread.php?t=14563)

bonfire 01-03-2011 02:57 PM

Program to draw 2 rectangles and fill 1 of them
 
1 Attachment(s)
Program to draw 2 rectangles and fill 1 of them


#include
#include
#include
#include
#include
#include

void main()
{
clrscr();
int gd = DETECT,gm,errorcode; //Requesting auto-detection.

//Initializing graphics and local variables.
initgraph (&gd, &gm, "d:\\bc3\\bgi"); //Path where graphics drivers are installed

//Read result of initialization.
errorcode = graphresult();

//An error occured.
if (errorcode != grOk)
{
cout << "Graphics error occured : \n" << grapherrormsg(errorcode) << endl;
cout << "Press any key to stop : ";
getch();
exit(1);
}

/*Drawing a rectangle having top LHS vertex at (300, 300)
and bottom RHS vertex at (600, 400)*/
rectangle(300, 300, 600, 400);
rectangle(100, 100, 200, 200);
getch();
floodfill(120, 120, WHITE);
getch();
closegraph();
}
This graphics program draws two rectangles, but fills in only one of them with a white color using the 'floodfill' command.


All times are GMT +5. The time now is 03:14 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.