Sem 4‎ > ‎CG LAB‎ > ‎

0 Starting Programs

posted Dec 18, 2011, 2:30 AM by Neil Mathew   [ updated Jan 1, 2012, 11:25 PM ]
[[ The Shortcuts ]]

( DevCpp )

F2:                   Save
Alt F2:             Close O/P Window
Ctrl F9:            Compile
Ctrl F10:           Run

( Turbo C using DOSBOX )
F2:                   Save F3:                   Open F10:                 Last Menu Item Selected Alt+Enter:        Exit/Open Full Screen Mode
Alt + PrtScr:      Specific Window screenshot

[[ Anyway...  ]]
First things first, you gotta get familiar with the syntax:

Dev C++ Syntax:

#include <graphics.h>

int main()


setcolor(3);      circle(getmaxx()*0.5,getmaxy()*0.5,200);  


return 1;

#include <graphics.h>
#include <conio.h>

int main()

int gdriver = DETECT, gmode;     initgraph(&gdriver, &gmode, "C:/TC/BGI/");
setcolor(3);      circle(getmaxx()*0.5,getmaxy()*0.5,200);

return 1;

Turbo C Syntax:

 int main(void)

         int gdriver = DETECT, gmode;     
         initgraph(&gdriver, &gmode, "C:/TC/BGI/");

 int i,j;  
//all declarations after gdriver declaration only, not above it.
         circle(getmaxx()*0.5, getmaxy()*0.5, 200);  


        return 0;


The line while(!kbhit()); does what getch(); does.

Left hand side, 

Using initwindow(x,y)

In DevC, only on window opens up.

I can specify the size of output window.

Right hand side, 

Using initgraph
addr_gdriver, addr_gmode, location_bgi_library)

In DevC, two windows opens up, 
one with the graphics, and 
another for text (cout).

The size is fixed at 641x481.