The simplest way is with the carriage return on *nix and Windows. Don't know exactly if that's exactly how wget does the progress bar, but it seems like it after a quick check.
It works as long as what you print stays the same length or gets bigger. If it gets smaller, you have to be a bit smarter to erase the characters left from the longer output.
for(unsigned times = 1; times; ++times)
if((times % 1111) == 0)
std::cout << "\rI've looped " << times << " times";
std::cout << "Now, onto more useful work";