C++ program to create a loading bar

By | September 26, 2012
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();
}


You May Also Like:

16 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

Leave a Reply

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