C++ gurus and learners, we program ourselves :P all work is CC licensed

Sunday, November 17

Loading bar in C++

Since we are high on special effects these days, so below is the code to make a loading bar in C++.

#include iostream.h
#include conio.h
#include windows.h
#include dos.h

void main()
{
 system("color 0a");
 cout<<"\n\n\n\t\t\t\tPlease wait while loading\n\n";
 char a=177, b=219;
 cout<<"\t\t\t\t";
 for (int i=0;i<=15;i++)
 cout<<a;
 cout<<"\r";
 cout<<"\t\t\t\t";
 for (int i=0;i<=15;i++)
 {
  cout<<b;
  for (int j=0;j<=1e8;j++); //You can also use sleep function instead of for loop
 }

 clrscr();
 cout<<"\n\n\n\t\t\tHELLO WORLD\n\n\t\t\tShashka made by Ivan :P";

 getch();
}

Output is :

hi my name is umar