Displaying text as a counter in a console?
Ok I just finished my functions to calculate my trajectories of bullets and would like to watch the number count down to zero without displaying it a million times. I would like to update the same number on the screen to reflect the current number the for loop has just calculated. Here is an example I think it has something to do with the cout but what else can I use?
for (float a = time; a > 0; a -= .0001F)
{
float b = 0.0;
b = intvel * cos(RADIANS * angle) * a;
cout << b << endl;
}
Windows 98/SE/ME SUCKS!
Deal with it!
if(windows crashes)
run Linux
else
yea right!!
RESIST WINDOWS XP!!!!!!!!!!
RESIST .NET TECH!!!!!!!!!!!
gotoxy() is what you''re looking for ... but that probably won''t work in Windows.
~~~~~~~~~~
Martee
http://www.csc.uvic.ca/~mdill
~~~~~~~~~~
Martee
http://www.csc.uvic.ca/~mdill
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
Yea you are right that don't work!! =) Would using a setw() work?
No it don't work either? I am stumped on this problem? Shouldn't their be a function that don't allow a newline after each cout?
Windows 98/SE/ME SUCKS!
Deal with it!
if(windows crashes)
run Linux
else
yea right!!
RESIST WINDOWS XP!!!!!!!!!!
RESIST .NET TECH!!!!!!!!!!!
Edited by - MARS_999 on May 18, 2001 9:27:37 PM
No it don't work either? I am stumped on this problem? Shouldn't their be a function that don't allow a newline after each cout?
Windows 98/SE/ME SUCKS!
Deal with it!
if(windows crashes)
run Linux
else
yea right!!
RESIST WINDOWS XP!!!!!!!!!!
RESIST .NET TECH!!!!!!!!!!!
Edited by - MARS_999 on May 18, 2001 9:27:37 PM
Try the clrscr(); function in the conio.h header file.
Mabye this will solve your problem.
Mabye this will solve your problem.
Bryan Neumann
Yea I think that would work but it must not be included in the header file anymore its coming up saying its a undeclared variable? I thought you could use something like sys()? I can''t remember how it''s syntax goes.
Windows 98/SE/ME SUCKS!
Deal with it!
if(windows crashes)
run Linux
else
yea right!!
RESIST WINDOWS XP!!!!!!!!!!
RESIST .NET TECH!!!!!!!!!!!
Windows 98/SE/ME SUCKS!
Deal with it!
if(windows crashes)
run Linux
else
yea right!!
RESIST WINDOWS XP!!!!!!!!!!
RESIST .NET TECH!!!!!!!!!!!
Thanks for the hints on Clrscr() I found it but unsure if this is the fastest way to clear the screen in a console app. I used this header file
#include "cstdlib"
then I used
system("cls");
works like a charm!!! =) Thanks for the ideas, this site kicks Ass! Keep up the good work people!
Windows 98/SE/ME SUCKS!
Deal with it!
if(windows crashes)
run Linux
else
yea right!!
RESIST WINDOWS XP!!!!!!!!!!
RESIST .NET TECH!!!!!!!!!!!
Edited by - MARS_999 on May 18, 2001 10:11:31 PM
#include "cstdlib"
then I used
system("cls");
works like a charm!!! =) Thanks for the ideas, this site kicks Ass! Keep up the good work people!
Windows 98/SE/ME SUCKS!
Deal with it!
if(windows crashes)
run Linux
else
yea right!!
RESIST WINDOWS XP!!!!!!!!!!
RESIST .NET TECH!!!!!!!!!!!
Edited by - MARS_999 on May 18, 2001 10:11:31 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement