tag:blogger.com,1999:blog-1336696728264063347.post8843234709494247736..comments2011-04-16T17:57:33.663-07:00Comments on Tek Nut :: Internet, Blogging, Web Development, Computer Help & Tips: C++ Console Progress BarCoconuterhttp://www.blogger.com/profile/06797054005834846709noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-1336696728264063347.post-53240274670347610992011-04-16T17:53:09.016-07:002011-04-16T17:53:09.016-07:00i cant get it work. please help.
here is my code:
...i cant get it work. please help.<br />here is my code:<br /><br />--------------------------<br />main.cpp<br />--------------------------<br />#include <br />#include "progress.h"<br /><br />int main()<br />{<br /> progressbar(100);<br /> return 0;<br />}<br /><br />-----------------<br />progress.h<br />-----------------<br />#include <br />#include <br /><br />using namespace std;<br /><br />void progressbar(int percent)<br />{<br /> static stringstream bars;<br /> static int x = 0;<br /> string slash[4];<br /> slash[0] = "\\";<br /> slash[1] = "-";<br /> slash[2] = "/";<br /> slash[3] = "|";<br /> bars << "|";<br /> cout << "\r"; // carriage return back to beginning of line<br /> cout << bars.str() << " " << slash[x] << " " << percent << " %"; // print the bars and percentage<br /> x++; // increment to make the slash appear to rotate<br /> if(x == 4)<br /> x = 0; // reset slash animation<br />}Anonymousnoreply@blogger.com