Project Euler #5 in C++
Welcome to Code Review!  This is actually pretty good code for a beginner, but here are some things that may help you improve your program.  

Simplify the code

The gcd routine looks like this:

long gcd(long a, long b)
{
    long t;

    if (b == 0) return a;

    while (b != 0) {
        t = b;
        b = a % b;
        a = t;
    }
    return a;
}


It can be simplified in three ways.  First, we can declare t within the loop.  Second, we can eliminate the if statement entirely.  Third, we can simplify the while loop condition to simply while (b) which is the same as while (b != 0):

long gcd(long a, long b)
{
    while (b) {
        long t = b;
        b = a % b;
        a = t;
    }
    return a;
}


Use const where appropriate

The value of n is constant, so it would make sense to declare it either const or even better constexpr.  

Consider signed versus unsigned

It's always worth thinking about the domain of the numbers in a calculation.  In this case, it seems that all of the numbers are probably intended to be unsigned, but they're declared long which gives signed numbers.  

Think of alternative algorithms and implementations

I think your algorithm is fast enough, but an alternative approach would instead be to calculate all of the unique prime factors of all of the numbers &lt; 20 and simply multiply them together.  With the judicious use of constexpr, one could even calculate everything at compile-time which would make for a very fast calculation.  For inspiration, see Compile-time sieve of Eratosthenes