-->

program to move a circle.

using turboc++
--------------------------------------------------------------------------
//moving a circle
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
clrscr();
int gdriver, gmode;    //variables declaration
gdriver=DETECT;        // detection of graphics driver
int move_location=20; //first location for circle to start
initgraph(&gdriver, &gmode, "c:\\tc\\BGI");
while(!kbhit()) //Checks for currently available keystrokes
{
circle(move_location,210,70);//draws circle
setcolor(BLUE);   //sets the color blue of circle
delay(100);       //delays of 1/10th of second
cleardevice();    //clears the previous screen/graphics
move_location++;
if(move_location>=600)
{
move_location=0;   //repeating the motion.
cleardevice();  //clears the graphics screen
}
}
getch();          //gets one character from user and closes the graphics.
closegraph();     //closes graphics.h
}

Program to draw triangle.

using turboc++
------------------------------------------------------------------------
//drawing triangle
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
int gdriver, gmode;    //variables declaration
gdriver=DETECT;        // detection of graphics driver

initgraph(&gdriver, &gmode, "c:\\tc\\BGI");
line(300,100,300,200);//draws frist line
line(300,200,350,200);//draws second line
line(300,100,350,200);//draws third line

getch();          //gets one character from user and closes the graphics.
closegraph();     //closes graphics.h
}

Program to draw a a line.

using turboc++
--------------------------------------------------------------------------------------------
//drawing triangle
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
int gdriver, gmode;    //variables declaration
gdriver=DETECT;        // detection of graphics driver

initgraph(&gdriver, &gmode, "c:\\tc\\BGI");
line(500,100,300,200);//draws line of two co-ordinates .

getch();          //gets one character from user and closes the graphics.
closegraph();     //closes graphics.h
}

program to display a text with background colour.

using turbo c++
--------------------------------------------------------------------------------------
//program to set background color.
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
int gdriver = DETECT, gmode;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
setbkcolor(BLUE);       //sets background color blue
printf("hello\n");      //prints hello
printf("how r u?");
getch();
closegraph();
}

program to understand outtext() and outtextxy().

using turboc++
--------------------------------------------------------------------------------------------------------
//understanding function of outtext() and outtextxy() function.
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gdriver = DETECT, gmode;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
clrscr();
outtext("hello");
// outtext displays a string in the viewport (graphics mode)
outtextxy(20,20,"different location\n");
// outtextxy displays a string at the specified location (graphics mode)
getch();
closegraph();
}

PROGRAM TO UNDERSTAND WINDOW() FUNCTION.

USING TURBOC++
-----------------------------------------------------------------------------------------
//understanding function of window() function.
#include<stdio.h>
#include<conio.h>// contains textcolor() and text background() and window().
void main()
{
clrscr();
window(10,10,40,11);     //generates window of given size
textcolor(BLUE); //sets textcolor blue
textbackground(BLACK); //Sets background black
cprintf("first line...........\n");
cprintf("second");
//sends formatted output to the text window on the screen
  //Does not work with printf.
getch();
}

/*second part prints line from that location where
first part is finished
*/

Program understand textcolor() and textbackground() function

using turboc++
------------------------------------------------------------------------------
//understanding textcolor in graphics
#include<stdio.h>
#include<conio.h>// contains textcolor() and text background().
void main()
{
clrscr();
textbackground(RED);  //Sets background red
textcolor(GREEN);    //sets textcolor green
cprintf("first line...........\n");
textcolor(GREEN);
textbackground(BLUE);
cprintf("This is a test\n");//sends formatted output to the text window on the screen
  //Does not work with printf.
getch();
}

/*second part prints line from that location where
first part is finished
*/
..............................................................................