就当做笔记挂上面了
double flag = 50;
int countadd = 0;
int mo = 0;
void process(double maxdata)
{
vector<const char*> load{ ".\0", "..\0", "...\0" };
double add = flag/maxdata;
char arr[101] = { 0 };
double cnt = -1;
const char* table = "/-|\\";
while (cnt < 99)
{
double tempnext = add + cnt;
while (cnt!=tempnext)
{
if (tempnext >99 )
{
tempnext = 99;
}
cnt += 1;
if (cnt > tempnext)
{
cnt = tempnext;
}
arr[(int)cnt] = '#';
}
countadd++;
if (countadd ==20)
{
mo=1;
}
else if (countadd == 40)
{
mo = 2;
}
if (countadd == 60)
{
countadd = 0;
mo = 0;
}
printf("[%-100s][%.2f%%][%c]\r", arr, cnt + 1, table[mo]);
fflush(stdout);
Sleep(2);
}
}