Will this give you an idear
Code:
#include <iostream>
#include <unistd.h>
int main()
{
std::string out_bar("");
for(int i=1; i <= 100; ++i)
{
if(!(i%10))
out_bar += "#";
std::cout << "\r" << out_bar;
std::cout.width(20 - out_bar.size());
std::cout << i << "%";
std::cout.flush();
sleep(1);
}
std::cout << std::endl;
return 0;
}
The key here is the
"\r" it returns the cursor to start of line, befor the writing begins, effectively overwriting the previus shown buffer on that line..
If you're looking for something like drawing windows or segments of the shown window, look at what curses.h or ncurses.h provides, but that is system specific.