Code:
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
int xmax, ymax;
int sg,st;
clrscr();
initgraph(&gdriver,&gmode,"");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
setbkcolor(BLACK);
initsig();
getch();
}
initsig()
{
int psg,x,quo,q;
int sg1[]={1,2,3,4,1,2,3,4,1,3,2};
for(psg=1;psg<600;psg++)
{
if(psg%50==0)
{
rectangle(psg,155,psg+5,160);
rectangle(psg,160,psg+5,165);
rectangle(psg,155,psg+5,160);
rectangle(psg,165,psg+5,170);
rectangle(psg,170,psg+5,175);
x=(psg/50)-1;
if(sg1[x]==2)
{
setfillstyle(1,YELLOW);
bar(psg,165,psg+5,170);
rectangle(psg,165,psg+5,170);
}
// else
if(sg1[x]==4)
{
setfillstyle(1,GREEN);
bar(psg,160,psg+5,165);
rectangle(psg,160,psg+5,165);
}
// else
if(sg1[x]==3)
{
setfillstyle(1,YELLOW);
bar(psg,155,psg+5,160);
rectangle(psg,155,psg+5,160);
setfillstyle(1,YELLOW);
bar(psg,165,psg+5,170);
rectangle(psg,165,psg+5,170);
}
// else
if(sg1[x]==1)
{
setfillstyle(1,RED);
bar(psg,170,psg+5,175);
rectangle(psg,170,psg+5,175);
}
}
}
}