C++ program to create a loading bar

C++ program to create a loading bar

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

void main()
{
int x=170,i,gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,”c:\tc\bgi”);
settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
outtextxy(170,180,”LOADING,PLEASE WAIT”);

for(i=0;i<300;++i)
{
delay(30);
line(x,200,x,220);
x++;
}
getch();
closegraph();
}

19 thoughts on “C++ program to create a loading bar

  1. Shehzad

    error found
    BGI ERROR : graphics not initialized (use initgraph)
    bro how to remove this error :S

    Reply
    1. Jassu Sharma

      There is no need to learn OpenGL ..
      because….the problem is with your code
      try this-

      initgraph(&gdriver,&gmode,"_____");

      just put the path to BGI folder in place of _____
      or if you have Turbo c++ by Neutron then you can use this –

      initgraph(&gd,&gm,"C:\Turboc3\BGI");

      this will help you

      Reply
      1. Sachin Soundar

        This is my code… which I am running..

        #include
        #include
        #include
        #include

        void main()
        {
        int x=170,i,gdriver=DETECT,gmode;
        initgraph(&gdriver,&gmode,”C:\TURBOC3\BGI”);
        settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
        outtextxy(170,180,”LOADING,PLEASE WAIT”);

        for(i=0;i<300;++i)
        {
        delay(30);
        line(x,200,x,220);
        x++;
        }
        getch();
        closegraph();
        }

        Error: BGI ERROR : graphics not initialized (use initgraph)
        P.s. My BGI location is correct.

        Reply
  2. sreelekha

    The program isn’t giving any output.Could you please let me know what to do.

    Reply
    1. Admin Post author

      which compiler you are using? it will work in turbo c++ only.

      Reply
  3. Anirudh Singh

    Hey i want to make a square bar which changes color when that bar is called….. Can anyone help

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *