- Use DOSBOX ,download and install it, and configure it.
- Go to safe mode and open TURBO C++ compiler ,usually resolution will be comfortable to IDE
- Use windows xp, in virtual box or WM ware workstation
First thing that we need to do before we can carry out any drawing activity is switch over the graphics mode . depending on the adapter and the monitor installed in your computer only some of graphics mode may available to you , display adapters are actually working in putting a picture on the screen .
To switch over to the graphics mode that offers best resolution we need to call the function initgraph() it will figure out the best resolution and puts the number corresponding to that mode in the variable “gm”, gm tells us which monitor are we are using ,and we need one more argument to this function say “gd” it is to mention device driver . Turbo C++ offers certain graphics drivers ,these are the files with extension BGI .depending upon what adapter we are using on of the adapter may get selected.So let us have a look on a sample program ,
This program will change background color on each hit on any key in the keyboard
# include <stdio.h>
# include<graphics.h>
# include <conio.h>
Void main()
{
int gd=DETECT,gm,i;
initgraph(&gd,&gm,””);
detectgraph(&gd,&gm);
for(i=0;i<=10;i++)
{
getch();
setbkcolor(i);
}
closegraph();
getch();
}
0 comments:
Post a Comment