今天给大家盘点一下c++控制台版进度条
颜色代码可自行添加
#include<cstdio>//头文件,有些可不要
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<climits>
#include<cstdlib>
#include<sstream>
#include<windows.h>
#include<stack>
#include<conio.h>
#include<string>
#include <ctime>
using namespace std;
void Progress_bar_First() {
int start = 1, end = 8;
for(; ; start >= 25 ? start = 1 : start ++, end >= 25 ? end = 1 : end ++) {
system("cls");
if(start < end){
for(int j = 1; j < start; j ++) {
printf("□");//重新改一下方块(复制粘贴)
}
for(int j = start; j <= end; j ++) {
printf("■");//一样的
}
for(int j = end + 1; j <= 25; j ++) {
printf("□");//重新改一下方块(复制粘贴)
}
puts("");
}
if(start > end){
for(int j = 1; j < end; j ++) {
printf("■");//重新改一下方块(复制粘贴)
}
for(int j = end; j < start; j ++) {
printf("□");//一样的
}
for(int j = start + 1; j <= 26; j ++) {
printf("■");//重新改一下方块(复制粘贴)
}
puts("");
}
Sleep(20);
}
system("cls");
}
经典进度条
形如
■■□□□
□■■□□
□□■■□
□□□■■
■□□□■
void Progress_bar_Second() {
for(int i = 1; i <= 25; i ++) {
system(</