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/)
-   Object Oriented Programming (http://bzupages.com/322-object-oriented-programming/)
-   -   Program to change the background colors on the screen (http://bzupages.com/f322/program-change-background-colors-screen-14565/)

bonfire 01-03-2011 03:00 PM

Program to change the background colors on the screen
 
1 Attachment(s)
Program to change the background colors on the screen


#include
#include
#include
#include

void main (int)
{
int gdriver=DETECT,gmode,errorcode; //Requesting auto-detection.
int midx,midy,x;
//Initializing graphics and local variables.
initgraph(&gdriver,&gmode,"d:\\bc3\\bgi");
//Reading result of initialization.
errorcode=graphresult();
if(errorcode!=grOk)
//An error occurred.
{
printf("Graphics error occurred : %s \n",grapherrormsg(errorcode));
printf("Press any key to stop : ");
getch();
exit(1); //Terminate the program due to error.
}
/*Changing the background color.
Note : Press enter to see the first screen as it is black and
it may appear as if the program has stopped running.*/
for(x=0;x<=15;x++)
{
setbkcolor(x);
getch();
}
closegraph();
}
This graphics program changes the background colors on the screen gradually from black to white using the 'setbkcolor' command.


All times are GMT +5. The time now is 05:47 PM.

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