Home » » C++ program to create a loading bar

C++ program to create a loading bar

Written By Neeraj Mishra on Wednesday, September 26, 2012 | 8:30 AM

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();
}

12 comments:

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

    ReplyDelete
    Replies
    1. There is only one way to fix that error.
      Learn OpenGL.

      Delete
    2. 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

      Delete
  2. cannot find iostream.h and graphic.h, microsoft visual studio 2010....

    ReplyDelete
  3. In function initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); , you have the path for graphic driver <"c:\\tc\\bgi">. Correct the graphic driver.

    ReplyDelete
  4. Make sure "c:\\tc\\bgi" is pointing to the right directory

    ReplyDelete
  5. This program generates linker error every time I use it it does no opens

    ReplyDelete
    Replies
    1. This program works in turbo c++, which compiler you are using?

      Delete
  6. program nt working.....plzz give a solution

    ReplyDelete

Have any Doubt? Ask Here!