-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathprogress_bar.hpp
More file actions
32 lines (30 loc) · 787 Bytes
/
Copy pathprogress_bar.hpp
File metadata and controls
32 lines (30 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<iostream>
struct progress{
// this struct is here for maintaining progress bar feature
// it doesn't have any additional function
// It isn't neccessary for the program
long int MAX=0,CURRENT=0,LAST=0;
int percentage=0;
void update(){
if(CURRENT*100/MAX>percentage){
percentage=CURRENT*100/MAX;
BAR();
}
}
void current(long int a){
CURRENT=a;
update();
}
void next(long int a){
CURRENT+=LAST;
LAST=a;
update();
}
void BAR(){
system("clear");
std::cout<<'[';
for(int i=1;i<=percentage;i++)std::cout<<'#';
for(int i=1;i<=100-percentage;i++)std::cout<<':';
std::cout<<"]:%"<<percentage<<std::endl;
}
};