I need to put in a loading bar to my assignment program so that it will look nicer.
Anyone knows how to make it??
I need to put in a loading bar to my assignment program so that it will look nicer.
Anyone knows how to make it??
And which of the many different kinds of operating systems, compilers and displays are we supposed to assume from your terse post?
> Anyone knows how to make it??
How To Ask Questions The Smart Way
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Is it a gui? a console?
In any case the progress value can be mapped to the 'progress bar' area with something like:
Code:progress = i / 100 // ' i ' being your loop counter value progressBar.fillWidth = progress * progressBar.width
Last edited by rogster001; 07-05-2012 at 08:10 AM.
Thought for the day:FLTK: "The most fun you can have with your clothes on.""Are you sure your sanity chip is fully screwed in sir?" (Kryten)
Stroustrup:
"If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"
salem, currently I am using Windows 7 and c ++
rogster001, can u give me an example of full program of that ?
I am just a beginner and cant get what u mean ><
You should answer these questions:
Originally Posted by SalemOriginally Posted by rogster001
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
> salem, currently I am using Windows 7 and c ++
C++ covers a multitude of sins from TurboC++ through to Visual Studio 20xx (whatever the latest number is).
Which compiler (name and version) are you using?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I am using microsoft visual studio 2010
Where can i get know which version i am using?
I am going to assume you are doing a simple console output.
The most simple way to express progress is a numeric percentage eh?
so if your program has to loop 100,000 times before it is finished then
use the counter value eg 75 loops so far to obtain a percentage and output it
with a message saying like "progress is... X% of completed"
your problem then only becomes either repeatedly clearing the screen to keep your display
in place, or using gotoxy functions to just write the percentage as it increases
for a progress 'bar'
Why not consider just outputting a simple ' # ' symbol ? every 100 iterations of your loop,
so then you get a nice little effect
##########
done!
But consider this - it is likely your program, assuming it only performs a basic function, will execute so fast that you will not even see the progress effect anyway, you will just hit run and then see " 100% " immediately
and you would have to artificially slow your program down to view it increasing
Last edited by rogster001; 07-05-2012 at 09:06 AM.
Thought for the day:FLTK: "The most fun you can have with your clothes on.""Are you sure your sanity chip is fully screwed in sir?" (Kryten)
Stroustrup:
"If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"
Some advice - perhaps you should put this project off until you learn the language well enough to fully understand how to implement a progress bar. If you're completely at a loss for how to implement such a function, then that probably means you're not ready to undertake such a challenge.
On the other hand, if you're experienced enough to attempt it - even if you can't get it to work right - and provide the code you've tried so far, you'll receive much better feedback from the contributors of this forum.
p.s. you could use "\r" escape character to keep your progress indicator, or progress value in place as a quick workaround -
Thought for the day:FLTK: "The most fun you can have with your clothes on.""Are you sure your sanity chip is fully screwed in sir?" (Kryten)
Stroustrup:
"If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"