Tuesday, 10 January 2012

Create Graphical Loading Bar in C



#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>

void main(void)
{
int driver=DETECT, mode;


        int i;

         initgraph(&driver,&mode,"c:\\tc\\bgi");   //initialize graphics mode
textcolor(BLACK);      //background color

        moveto(200,180);        //loading process
outtext("Loading, please wait...");
   for(i=0;i<600;i+=15)
   {
    setcolor(3);            //loading bar color
    line(20,380,i+39,380);
    delay(150);         //slow down loop speed
   }
setcolor(WHITE);
moveto(210,200);
outtext("Loading Completed!");   //loading process complete
delay(1000);
       closegraph();               //close graphics mode


}




If you have any problem with the above code, you can contact me...