#include "Node.h" #include "Stack.h" #include #include #include #define TITLE_DIM 15 void main() { Node n1; Node n2; Node n3; Node n4,n5,n6; int side1; int value1; int color1; Node* next1=NULL; char title1[TITLE_DIM]; char title2[TITLE_DIM]; char title3[TITLE_DIM]; char title4[TITLE_DIM]; char title5[TITLE_DIM]; char title6[TITLE_DIM]; Stack st1, st2,st3; int n_elements; // ===================================== // Creating the constants. side1=0; value1=13; color1=1; strcpy( title1, "Quine Spade" ); strcpy( title2, "King Club" ); strcpy( title3, "Valet Heart" ); strcpy( title4, "Four Spade" ); strcpy( title5, "Five Club" ); strcpy( title6, "Six Heart" ); // ===================================== // Creating the Nodes next1=NULL; n1.set(side1, value1, color1, title1,next1); //n2.set(1,13,2,title2,&n1); n3.set(1,11,3,title3); n3.show(); cout << "out" << endl; n4.set(1,4,1,title4); n5.set(1,5,2,title5); n6.set(1,6,3,title6); // ==================================== // Creating the stacks. st2.set(); st1.set(&n1); st1.show(); st2.show(); st1.push(&n3); st1.show(); // ----------- st3.set(&n4); st3.push(&n5); st3.push(&n6); // ==================================== // Count the number of elements in the stack. n_elements=st1.count(); cout << "The number of cards in the stack no.1: "<show(); // ==================================== // // delete the bottom card. Node * p_Node_last; st1.show(); p_Node_last=st1.bottomCard(); if(p_Node_last!=NULL) { p_Node_last->show(); } // ========================== // // reverse the stack. int stam1=17; st1.reverse(); int stam2=12; st1.remove(2); int stam3=13; }