Skip to content

Instantly share code, notes, and snippets.

@hb3p8
Last active August 16, 2016 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hb3p8/1791e7495ba6ab1d9c242c07d56e50b4 to your computer and use it in GitHub Desktop.
Save hb3p8/1791e7495ba6ab1d9c242c07d56e50b4 to your computer and use it in GitHub Desktop.
float aProgress = 0.0;
while (aProgress < 1.0) {
int aBarWidth = 70;
std::cout << "[";
int aPos = (int) (aBarWidth * aProgress);
for (int i = 0; i < aBarWidth; ++i) {
if (i < aPos) std::cout << "=";
else if (i == aPos) std::cout << ">";
else std::cout << " ";
}
std::cout << "] " << (int) (aProgress * 100.0) << " %\r";
std::cout.flush();
aProgress += 0.16; // for demonstration only
}
std::cout << std::endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment