Skip to content

Instantly share code, notes, and snippets.

@hb3p8
Last active Aug 16, 2016
Embed
What would you like to do?
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