#include // Laboratory 12 in 15-127 #include // #define C cout<< // Free from Metrowerks at Last #define R return // #define I int // Name: Tom Murphy 7 #define F ifstream //////// #define N new ////// Compile in g++! Needs a file which is a list #define W char //// of integers called lab12.txt. #define Z for( // struct p{I n;p*l;p*r;};B(p*&,F&);A(p*&,p*);P(p*,I);S(p*&);enum{a,b,c,};W*L(I); X(p*&);X(p*&h){h?X(h->l),X(h ->r),delete h:0;}main(){p*h=0;F i(L(3));B(h,i);i. close();Z I w=0;w^6;w+++1)C(w ^3?"\n":(S(h),"\n--\n"))<< L(w%3),P(h,w%3);X(h); cin.get();R(I)0e0;}B(p*&h,F&i){I x;Z;i>>x;)A(h,N p((p){x}));}A(p*&h,p*n){h||!( h=n)?A(h->n>n->n?h->l:h->r,n):3;}P(p*h,I m){!(m^b)?(h?(C h->n<<' ',P(h->l, m), P(h->r,m)):5):(!m?(h?(P(h->l,m),C h->n<<' ',P(h->r,m)):0):(h?(P(h->l,m),P(h->r ,m),C h->n<<' ',9):1));}W*L(I v){W*l=N W[10];W*x=v*20+"1|1||I||1|1|1|IlIlIl1|" "1I|lll1|1|1|IlIlIl1I|1l1l|1|1|1|IlIlIl111llIIII|1|l|I1l|Il";Z I k=0;k<10;x++, ++x)l[k++]="1\0x2bestpal.iron"[(*x&4)|(*x&16)/2|(x[1]&4)/4|(x[1]&16)/8];R l;}S (p*&h){h?(h->r&&!(h->n^h->r->n)?(h->r=N p((p){h->n-1,0,h->r})):00),S(h->r),S(h ->l) /* Bye Bye Jim */ :( I)&h^42;}