C/C++进度条
#include <unistd.h>
#include <stdio.h>
#include <string>
void ProgressBar(float fTotal)
{
for (int i = 0; i <= fTotal; ++i)
{
double dCurrentProgress = i * 100.0 / fTotal;
printf("[ Killing process ]:%s[%0.2f%%]\r", std::string((unsigned int)dCurrentProgress, '*').c_str(), dCurrentProgress);
fflush(stdout);
usleep(1000); //1000us
}
}
int main() {
ProgressBar(10000);
printf("\n");
return 0;
}