I was trying to figure this out but for some reason it is illuding me

Ministack header provided

#ifndef MINISTACK_H

#define MINISTACK_H

const int MINI_STACK_SIZE = 5;  // Fixed number of element in stack

class MiniStack
{
  private:
    int num;               // Number of values stored in MiniStack
    char* stackPtr;        // Pointer to array representing stack

  public:
    MiniStack();           // Default constructor
    void Push(char ch);    // Adds element to top of stack assuming stack not full
    void Pop();            // Removes element from top of stack
    void MakeEmpty();      // Empties ministack
    char Top();            // Returns copy of value stored at top of stack
    bool IsFull() const;   // Returns true if ministack is full; false otherwise
    bool IsEmpty() const;  // Returns true if ministack empty; false otherwise
    void Print() const;    // Prints stack contents, top to bottom
    ~MiniStack();          // Destructor
};

#endif

Big stack header

#ifndef BIGSTACK_H

#define BIGSTACK_H

#include "ministack.h"

struct ListNode            // Description of a ListNode struct
{
    MiniStack* stackPtr;   // Pointer to a MiniStack object
    ListNode*  nextPtr;    // Pointer to next ListNode
};


class BigStack             // Description of BigStack class
{
  private:
    int num;               // Total number of values stored in MiniStack
    ListNode* headPtr;     // Pointer to head of list of nodes representing bigstack

  public:
    BigStack();            // Default constructor
    void Push(char ch);    // Adds element to top of stack assuming stack not full
    void Pop();            // Removes element from top of stack
    char Top();            // Returns copy of top value assuming stack not empty
    bool IsFull() const;   // Returns true if ministack is full; false otherwise
    bool IsEmpty() const;  // Returns true if ministack empty; false otherwise
    void Print() const;    // Prints stack contents, top to bottom
    ~BigStack();           // Destructor
};

#endif

ministack implemintation I wrote this code here.

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <cmath>
#include <new>
#include <cstddef>
#include "ministack.h"
#include "bigstack.h"

using namespace std;

MiniStack::MiniStack()					// Default constructor
{
    stackPtr = new char[MINI_STACK_SIZE];
    num = 0;
}

void MiniStack::Push(char ch)			// Adds element to top of stack assuming stack not full
{
 	 
	 if (num >=0 && num <=4)
	 {
	  	 stackPtr[num] = ch;
 	 	 num++;
	 }
	 else if(num < 0)
	 {
		 num = 0;
	 	 stackPtr[num] = ch;
	 	 num++;
	 }
	 else
	    num = 5;
}

void MiniStack::Pop()					// Removes element from top of stack
{
 	num--;
}

void MiniStack::MakeEmpty()			// Empties ministack
{
 	num = -1;
}

char MiniStack::Top()					// Returns copy of value stored at top of stack
{
 	return stackPtr[num-1];
}

bool MiniStack::IsFull() const		// Returns true if ministack is full; false otherwise
{
	if(num == MINI_STACK_SIZE-1)
	return true;
	else
	return false;
}

bool MiniStack::IsEmpty() const		// Returns true if ministack empty; false otherwise
{
	if (num == 0)
	return true;
	else
	return false;
}

void MiniStack::Print() const			// Prints stack contents, top to bottom
{
	int n;
	n = num - 1;
	
	do
	{		
		if (n <= -1)
		break;
		else
		{
		cout << stackPtr[n] << " ";
		n--;
		}
		
	}while (n != -1);
   cout << endl;	
}

MiniStack::~MiniStack()					// Destructor
{
    do 
    {
	 num--;
	 }while (num >= 0);
}
bigstack implemintation
Once again I am having a problem with the push function.
how in the world do I get these two to work together.
I know that the headPtr points to the top of the link list and nextPtr points to the next node in the list and that the stackPtr points to the stack. But how would I put it all together. Do I do it in my main or in the implementation of the big stack. Please Please help I have been trying but I can not get it.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <cmath>
#include <new>
#include <cstddef>
#include "ministack.h"
#include "bigstack.h"

using namespace std;

BigStack::BigStack()             // Default constructor
{
    headPtr = NULL;
    num = 0;
}

void BigStack::Push(char ch)    // Adds element to top of stack assuming stack not full
{
    if (num == 0)
	{
        ListNode* nextPtr = new ListNode;
		nextPtr->nextPtr = headPtr;
		headPtr = nextPtr;
		num++;
	}
	nextPtr->ch = ch;
    nextPtr->stackPtr = ch;
    
}
void BigStack::Pop()            // Removes element from top of stack
{

}

char BigStack::Top()            // Returns copy of top value assuming stack not empty
{
}

bool BigStack::IsFull() const   // Returns true if ministack is full; false otherwise
{
}

bool BigStack::IsEmpty() const  // Returns true if ministack empty; false otherwise
{
}

void BigStack::Print() const    // Prints stack contents, top to bottom
{
	
}

BigStack::~BigStack()           // Destructor
{
}

>>I was trying to figure this out but for some reason it is illuding me

you will have to be a lot more specific than that.

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.