#include <stdio.h>
#include <conio.h>
#include <dos.h>
/*start_x : x-axis starting (progressbar starting[x-cordinate])end_x : x-axis ending (progressbar ending[x-cordinate])y : Row no. where progressbar should be placedsymbol : Symbol to be displayedstyle : 0 for smooth progressbar 1 for rough progressbardlytime : delay time (in milliseconds)fillclr : fill color for progressbarfillbkclr : fill backcolor for progressbarcolor may be from following option...Constant ³ValueÍÍÍÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍ BLACK ³ 0 BLUE ³ 1 GREEN ³ 2 CYAN ³ 3 RED ³ 4 MAGENTA ³ 5 BROWN ³ 6 LIGHTGRAY ³ 7 DARKGRAY ³ 8 LIGHTBLUE ³ 9 LIGHTGREEN ³ 10 LIGHTCYAN ³ 11 LIGHTRED ³ 12 LIGHTMAGENTA ³ 13 YELLOW ³ 14 WHITE ³ 15*/void progressbar(int start_x,int end_x,int y,char symbol,int style,int dlytime,int fillclr,int fillbkclr)
{
int i,len,temp,dly;
len=end_x-start_x;
dly=dlytime/len;
_setcursortype(_NOCURSOR);
textbackground(fillbkclr);
temp=start_x;
for (i=1;i<=len+1;++i,++start_x)
{
gotoxy(start_x,y);
cprintf("%c",symbol);
}
start_x=temp;
gotoxy(start_x,y);
textbackground(fillclr);
temp=start_x;
for (i=1;i<=len+1;++i,++start_x)
{
if(style==1){
if(i%2!=0){
gotoxy(start_x,y);
delay(dly);
cprintf("%c",symbol);
}
}
else{
gotoxy(start_x,y);
delay(dly);
cprintf("%c",symbol);
}
}
gotoxy(temp,y+1);
_setcursortype(_NORMALCURSOR);
}
void main(){
clrscr();
/*examples*/
progressbar(20,50,12,' ',0,2000,BLUE,LIGHTGRAY);
progressbar(10,70,14,' ',0,500,RED,YELLOW);
progressbar(30,40,16,' ',0,15000,MAGENTA,LIGHTGREEN);
getch();
}