Hello,
I am trying to do something simple I hope. Basically I have a counter in a for loop that counts from 1 to 500.
for
(int i = 0; i < 500; i++){
cout << i;
}
when this runs, it displays the numbers one after another like so: 123456789101112131415161718192021223 .....and so on.
I would like it to display one on top of the next number and not move one position to the right. So basically, if I slow it down, the user could actually see the numbers being counted out, but they will remain in the first position and not move over to the next position each time it is printed out. Basically like how a stop watch works.
This is in a console screen by the way.
Thanks for any help.
~zero

number counter issue
Tommy0204
I found how to spin the numbers. By simply placing the /r in front of the number, it will keep it in one position. Here is a sample.
for
(int i = 0; i < 10000; i++){
sim = (0 + rand() % 38);
cout << "\r" << sim;}
MsJovial2
MariJo
The console functions also allow to clear portions of the screen. Just look into the cls function you will see how it works.
Also there are libraries for those basic console functions.
Just look at www.codeproject.com
Nicolas Louis Evaluant
Better use, the cls function described here:
http://support.microsoft.com/support/kb/articles/q99/2/61.asp
IraMaster
system("cls")
Kuphryn
godblessyou
Martin,
You know how on some computers that when you boot them up, they will display the amount of system RAM in the computer and the screen does this by displaying the RAM counting up wards
That is what I am trying to accomplish, that same "look" with my counter displaying numbers. Would using the cls function to do this accomplish that or is there a better way