changing whats already outputted (DOS)

Hi.

im trying to make a percentage written to the screen, which should be able to change from "  0%" to "100%" while running a loop.
is there a simple way to this?
LVL 2
Tai-SanAsked:
Who is Participating?
 
AxterConnect With a Mentor Commented:
In DOS, you can use the "\r" character to bring the line back to the beginning without moving it to the next line.

Example code:

int main()
{
      printf("\
===================================\n\
        Processing Compute...\n\
        - kills : 2159\n\
        - ratio : 0.000514\n\
        - uvert optimization performed.\n\
        - 4196242 averaged normal calculated.\n\
");

      for(int i = 1;i < 101;++i)
      {
            printf("\r        - %03i%% creating mesh", i);
            Sleep(50);
      }
0
 
AxterCommented:
You can use cout or printf

#include <iostream>

int Num = 0;
std::cout << Num << "%" << std::endl;
Num += 100;
std::cout << Num << "%" << std::endl;

or

#include <stdio.h>

int Num = 0;
printf("%i%%/n", Num);
Num += 100;
printf("%i%%/n", Num);
0
 
Tai-SanAuthor Commented:
i dont think you understand my question. assume i output this:
===================================
        Processing Compute...
        - kills : 2159
        - ratio : 0.000514
        - uvert optimization performed.
        - 4196242 averaged normal calculated.
        - xxx% creating mesh

and the xxx should be able to change (like in dos setup programs) from "  0" to "100"
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
AxterCommented:
What compiler are you using?

And is this a DOS application?
0
 
Tai-SanAuthor Commented:
im running thw Microsoft Visual C++ .NET 2002 with the compiler/linker that follows. and yes, this is a dos application
0
 
AxterCommented:
>>im running thw Microsoft Visual C++ .NET 2002 with the compiler/linker that follows. and yes, this is a dos
>>application

Then the above code I posted will work.
0
All Courses

From novice to tech pro — start learning today.