Solution for the n-queens problem

This is a simple C++ code to obtain all solutions of the n queens problem.


/* author: ncomputers.org */
#include<iostream>
using namespace std;

template<typename type>
class all{
    typedef unsigned int seconds;

    const seconds start;
    const type nm1,n2m1;
    type *const sol,*const solnm1;
    bool *const line1,*const line2;
    type *p0,*columns,*lastcolumn;
    type x,y;
public:
    all(const type n,type quiet):
    start(time(0)),nm1(n-1),n2m1(2*n-1),
    sol(new type[n]),solnm1(sol+nm1),
    line1(new bool[n2m1]()),line2(new bool[n2m1]()+nm1),
    columns(new type[n]),lastcolumn(new type[n])
    {
        p0=columns,x=0;
        do *p0=x;
        while(p0++,++x<n);//Awaiting do...while improvement
        *lastcolumn=0,quiet=(bool)quiet,y=0;
        limit:
        if(*lastcolumn==n-y){
            if(y==0){if(quiet)cout<<endl;return;}
            remove:
            y--;
            x=*--columns,*columns=*(p0=columns+(*--lastcolumn)++),*p0=x;
            *(line1+y+x)=*(line2+y-x)=false;
            goto limit;
        }
        check:
        x=*(columns+*lastcolumn);
        if(*(line1+y+x)||*(line2+y-x)){
            ++*lastcolumn;
            goto limit;
        }
        else if(y<nm1){
            *(sol+y)=x;
            *(line1+y+x)=*(line2+y-x)=true;
            *(columns+*lastcolumn)=*columns,*columns++=x;
            *++lastcolumn=0;
            y++;
            goto check;
        }
        else{
            if(quiet){cout<<"\r"<<quiet++<<" solutions in "<<time(0)-start<<" seconds",cout.flush();}
            else {p0=sol;do cout<<*p0<<',';while(++p0<solnm1);cout<<x<<endl;}
            goto remove;
        }
    }~all(){delete[]sol,delete[]line1,delete[](line2-nm1),delete[](columns-y),delete[](lastcolumn-y);}
};

int main(){
    typedef unsigned int type;
    type input0=-1,input1=input0/2;
    cout<<"queens (4-"<<input1<<")? ",cin>>input0;
    if(input0<4||input0>input1)return 1;
    cout<<"quiet (1/0)? ",cin>>input1;
    delete new all<type>(input0,input1);
    return 0;
};