How can I design a clock?

Hello,
I have a question about writing a program in C++ to put up a
clock face. Below is some code to try, but I'm afraid
it's not a very good picture.
The program works OK. There are some bugs, like the program
overwrites itself. I have Bloodshed C++, but I wrote the code
in Borland C++ ver. 4.52.
There is no way to re-size the clock.
What's a good way to position the clock and yet allow it
to be resizable? I don't mind starting again. The numbers
to position it are made up. I would like to dump them.
Thank you if you have some time.
Jim Devaney
P.S, It only allows 9000 characters. I did not post it all.
/***************************************************************/
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <dos.h>

void prjmin05 ( int );
void prjhr05 ( int );
int main(void) {
time_t t;
int n, x, y, z;

/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;

/* initialize graphics, local variables */
initgraph(&gdriver, &gmode, "");

/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk)
/* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
/* draw ellipses, like circles */
setcolor(15); /* white */
ellipse(midx, midy, 0, 360, 137, 137);
setcolor(14); /* yellow */
ellipse(midx, midy, 0, 360, 135, 135);

/************************************************************/
/* first row of markers */
x = 0;
y = 0;
z = 0;

time(&t);
printf("Today's date and time: %s\n", ctime(&t));
setcolor(15);
line ( 319, 239, 319, 105 ); /* second hand */
setcolor(2);
line ( 319, 239, 319, 135 ); /* minute hand */
setcolor(8);
line ( 319, 239, 319, 155 ); /* hour hand */
/**************************************************************************/
for (z = 0; z <= 0; z++ ) {
for (x = 0, y = 0; x <= 59, y <= 59; x++, y++ ) { /* set x = 0 */
for ( n = 0; n <= 0; n++ ) { /* to 59 secs. */
setcolor(0);
line ( 319, 239, 319, 105 );
setcolor(15);
line ( 319, 239, 332, 106 );
prjmin05(y-1);
prjhr05(z);
delay (1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 332, 106 );
setcolor(15);
line ( 319, 239, 345, 107 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 345, 107 );
setcolor(15);
line ( 319, 239, 358, 110 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 358, 110 );
setcolor(15);
line ( 319, 239, 370, 114 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 370, 114 );
setcolor(15);
line ( 319, 239, 382, 120 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 382, 120 );
setcolor(15);
line ( 319, 239, 393, 128 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 393, 128 );
setcolor(15);
line ( 319, 239, 404, 136 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 404, 136 );
setcolor(15);
line ( 319, 239, 413, 144 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 413, 144 );
setcolor(15);
line ( 319, 239, 422, 153 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 422, 153 );
setcolor(15);
line ( 319, 239, 431, 165 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 431, 165 );
setcolor(15);
line ( 319, 239, 439, 179 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 439, 179 );
setcolor(15);
line ( 319, 239, 445, 194 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 445, 194 );
setcolor(15);
line ( 319, 239, 450, 209 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
for ( n = 0; n <= 0; n++ ) {
setcolor(0);
line ( 319, 239, 450, 209 );
setcolor(15);
line ( 319, 239, 452, 224 );
prjmin05(y-1);
prjhr05(z);
delay(1000);
}
/************************************************************/
time(&t);
printf("Today's date and time: %s\n", ctime(&t));

getch();
closegraph();
return (0);
}
/************************************************************/
Use Win32 api and see the Petzold sample for a clock.
Topic archived. No new replies allowed.