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;
}

get your compiler and change some variable, like the value of N1/N2,
make N1+0 or just anything, after a while. u can learn the algorithm by yourself.

the thing is i did not understand the code, as i said i am new...
CAN SOME ONE EXPLAIN IT TO ME?? thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.