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 :

9 comments :

  1. sir koi output bhi post ker dein

    ReplyDelete
  2. Sir i hope you will not mind of my new post about that loading bar ;; i have refered you in there too for understanding point.... Actually i dont have much ideas but i can make programs ;; i'm sure this wont happen again ; regards usman shery

    ReplyDelete
  3. No problem buddy. This is open community. You can post anything you want. I am happy that you understood the concept and used it to make a program for yourself. What more can I want?
    Keep making programs like this and you'll have great success.

    ReplyDelete
  4. "Please Don't try This at home"
    WWE

    ReplyDelete
  5. Hwaah its work :-:

    But there's a several changes i added like:
    1.adding using namespace std;
    2.change 'void main()' to 'int main()'
    3.And i cant add clrscr, cuz its say its not not delcared in this scope

    Anyway this is so cool for me that was a beginner XD

    ReplyDelete