hello guys,
i found a piece of code in the net..
this code is a progress bar loop programme.
I am new to programming, and i am not able to understand this code.
PLEASE can anyone explain it or tell a simpler version of it.
thanks(sorry for my english)
#include <iostream>
#define N1 1000000000
#define N2 100000000
using namespace std;
int main (void)
{
int counter;
for (counter = 0; counter < (N1+1); ++counter) {
if ((counter / N2) == 2 && (counter % N2) == 0) {
cout << "[==== ]20%\r";
}
else if ((counter / N2) == 4 && (counter % N2) == 0) {
cout << "[======== ]40%\r";
}
else if ((counter / N2) == 6 && (counter % N2) == 0) {
cout << "[============ ]60%\r";
}
else if ((counter / N2) == 8 && (counter % N2) == 0) {
cout << "[================ ]80%\r";
}
else if ((counter / N2) == 10 && (counter % N2) == 0) {
cout << "[====================]100%" << endl;
}
}
return 0;
}