/* Program BAR_2.C
**
** Illustrates bars with various fill patterns.
**
** Bar is drawn and colors are changed every second.
**
** P. H. Anderson, 30 Sept 93; Dec 9, '94
**
*/
#include <stdio.h>
#include <graphics.h>
#include <dos.h>
void main(void)
{
int graphdriver = DETECT, graphmode, linestyle=0, color;
int n;
char string[80];
initgraph(&graphdriver, &graphmode, "c:\\turboc");
/* detect and initialize graphics system */
setlinestyle(SOLID_LINE, linestyle, NORM_WIDTH);
for (color=0; color<16; color++)
{
setcolor(RED); /* outline of bar is red */
for (n=0; n<12; n++)
{
setfillstyle(n, color);
bar3d(50*n+5, 50, 50*n+50, 300, 0, 0);
sprintf(string, "%d", n);
outtextxy(50*n+20, 310, string);
}
sprintf(string, "Color = %d", color);
setcolor(MAGENTA); /* text is in magenta */
outtextxy(100, 400, string);
/* outtextxy, (x, y, text */
sleep(1); /* pause to admire */
}
closegraph();
}