Here I am just giving some C graphics source codes so that you can you it for your projects. All these C source codes are made by me and no problem that you can use it as you wish. In all the programs the graphics initialisation is different So if your Turbo C installed on F drive then you change the graphics option as
 initgraph(&gd,&gm, "f:\\tc\\bgi"); or initgraph(&gd,&gm," ");
 rest program remains the same.    For more about C graphics see
 book
 
C graphics by Yashavant Kanetkar .You can get all these source codes from my e-book Parallel Port

A SIMPLE CLOCK
This is a simple clock which gives the time of the computer when you execute the program.This code is  published on www.sourcecodesworld.com in C graphics section,but they changed my code.All these are compiled on Turbo C3.0

#include<graphics.h>
#include<time.h>
#include<math.h>
#include<dos.h>
#include<stdio.h>
#define PI 3.14569
void sounder();
void bibin();
void main()
{
int gd=DETECT,gm;
time_t start, finish, now;
struct tm *ptr;
char *c, buf1[80],h[3],m[3],s[3];
double duration;
int i=0,j,k,x,y,xm,ym,xh,yh;
/* Record the time the program starts execution. */
initgraph(&gd,&gm,"e:\\tc\\bgi");
clrscr();
setfillstyle(SOLID_FILL,BLUE);
bar3d(170,100,470,400,10,1);
setcolor(GREEN);

circle(320,250,100);//for outercircle inner radius
circle(320,250,125);//for outercircle outer radius
circle(320,250,1);//for innercircle inner radius
circle(320,250,7);//for innercircle outer radius
setfillstyle(SOLID_FILL,RED); //for outercircle filling red color
floodfill(430,250,GREEN);//filling outercircle with green border
floodfill(320,250,GREEN);
setfillstyle(SOLID_FILL,MAGENTA); //for innercircle filling mangenta
floodfill(325,250,GREEN); //filling innercilling with green border
settextstyle(1,0,1);
setcolor(15);
outtextxy(318,352,"6");
outtextxy(376,334,"5");
outtextxy(410,294,"4");
outtextxy(430,237,"3");
outtextxy(417,186,"2");
outtextxy(376,144,"1");
outtextxy(310,127,"12");
outtextxy(254,140,"11");
outtextxy(213,182,"10");
outtextxy(206,237,"9");
outtextxy(221,301,"8");
outtextxy(261,338,"7");
/* Record the current time, using the alternate method of */
/* calling time(). */
time(&now);
/* Convert the time_t value into a type tm structure. */
ptr = localtime(&now);
/* Create and display a formatted string containing */
/* the current time. */

c = asctime(ptr);
h[0]=c[11];
h[1]=c[12];
m[0]=c[14];
m[1]=c[15];
s[0]=c[17];
s[1]=c[18];
i=atoi(h);
if(i>11) i=i-12;
j=atoi(m);
xm=320+80*(sin(PI/30*j));
ym=250-80*(cos(PI/30*j));
xh=320+60*sin(PI/6*i+PI/360*j);
yh=250-60*cos(PI/6*i+PI/360*j);
setlinestyle(SOLID_LINE,1,3);
setcolor(BROWN);
line(320,250,xm,ym);
setcolor(MAGENTA);
line(320,250,xh,yh);
setbkcolor(GREEN);
sounder();
getch();
bibin();
closegraph();
restorecrtmode();
}
void sounder()
{
int frequency;

for(frequency=4000;frequency<5000;frequency++)
sound(frequency);
nosound();
return;
}
void bibin()
{
int midx=320,midy=230;
cleardevice();
setbkcolor(RED);
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(GREEN);
settextstyle(5, VERT_DIR, 4);
outtextxy(midx-300, midy, "Programmed By");
settextstyle(2, HORIZ_DIR, 8);
setcolor(14);
outtextxy(midx, midy, "BIBIN JOHN B.E ELECTRONICS
ENGINEERING");
outtextxy(midx,midy+20,"MNNIT ALLAHABAD, INDIA");
outtextxy(midx,midy+100,"e-mail: [email protected]");
delay(4000);
return ;
}

 

Hosted by www.Geocities.ws

1