00001 #include <iostream> 00002 00003 00004 #ifndef FORMAT_OUTPUT 00005 #define FORMAT_OUTPUT 00006 00007 struct PBar 00008 { 00009 PBar(int i) : progress(i){} 00010 PBar(double i): progress(i*100.0){} 00011 00012 friend ostream& operator << (ostream& out, const PBar& pb ){ 00013 for (int i=0;i<100;i++) 00014 out << '\b'; 00015 out << pb.progress << '%' << flush; 00016 return out; 00017 } 00018 00019 double progress; 00020 }; 00021 00022 #endif 00023