Sunday, January 27, 2008

c++: animated process bar in c++

A process bar is useful to present the current processing status, here is my example:
void ProcessBar(int thisevt, int totalevt) {
if ( thisevt%1000 != 0 ) return ;
int totalc = 30;
int ic = (int)1.*totalc*thisevt/totalevt;
cout << "Status: [";
for (int a=0; a
cout << "=";
for (int b=0; b
cout << " ";
cout << "]";

printf("%6.2f%%", 100.*thisevt/totalevt);

//backspace
for(int a = 0; a <>
cout << "\b";
}

(of course, the code is specially for high energy physics analysis on event level, you could change it for timing etc...)

Locations of visitors to this page