I can't get it to compile. I've tried so many things.

The errors

|29|error: expected unqualified-id before '{' token|
|266|error: expected '}' at end of input|
|266|error: expected unqualified-id at end of input|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Here is the code`

#include <iostream>
using namespace std;

template <class T>
//
// ADD STATEMENT  BELOW TO DECLARE A CLASS NAMED DynStack.
class DynStack
{
private:
   //
   //  STATEMENT BELOW TO DECLARE A struct NAMED StackNode.
   struct StackNode;

T value;
    StackNode *next;

   {
    T value;
    StackNode *next;
    // Constructor
    StackNode(T val, StackNode *nextP)
    {
      value = val;
      //
      //  STATEMENT BELOW TO ASSIGN nextP TO THE StackNode POINTER.
      StackNode = nextP;
    }
   };
   StackNode *top;
public:
   DynStack()
   {
      // STATEMENT BELOW TO ASSIGN NULL TO BE AT THE TOP OF THE STACK.
      top = NULL;
   }

   void push(T);
   //
   // STATEMENT  BELOW TO DECLARE FUNCTION PROTOTYPE pop.
   // THE FUNCTION DOES NOT RETURN DATA.
   // THE FUNCTIONS RECEIVES THE CLASS TEMPLATE VARIABLE "T" PASSED BY REFERENCE.
   void pop(T &);
   bool isEmpty();
};
//
// define the "push" function
template <class T>
void DynStack<T>::push(T val)
{
    top = new  StackNode(val, top);
}
//
// define "pop" function
template <class T>
void DynStack<T>::pop(T &val)
{
    StackNode *temp
    //
    //  STATEMENT  TO DETERMINE IF THE STACK IS EMPTY.
    if(isEmpty())
    {
        cout << "The stack is empty.\n";
        return;
    }
    else        // Pop value off top of stack
    {
        //
        // STATEMENT BELOW TO ASSIGN THE VARIABLE val TO CONTAIN
        // THE VALUE AT THE TOP OF THE STACK.
        val = top;
        temp = top;
        top = top->next;
        delete temp;
    }
}
//
// define "isEmpty()" function
template <class T>
bool DynStack<T>:isEmpty()
{
    if (!top)
        return true;
    else return false;
}
//
// ************* End of stack structure
//
// ************* Beginning of queue structure **********
//
template <class T>
class Dynque
{
private:
    // Node to hold queue elements
    struct QueueNode
    {
      T value;
      QueueNode *next;
      QueueNode(T val, QueueNode *nextp = NULL)
      {
         value = val; next = nextp;
      }
   };
   QueueNode *front;
   QueueNode *rear;
   int numItems;
public:
   Dynque();
   ~Dynque();
   void enqueue(T);
   void dequeue(T &);
   bool isEmpty();
   bool isFull();
   void clear();
};
//
// define constructor
template <class T>
Dynque<T>::Dynque()
{
   front = NULL;
   rear = NULL;
   numItems = 0;
}
//
// define destructor
template <class T>;
Dynque<T>::~Dynque()
{
   clear();
}
//
// define "enqueue" function
template <class T>
void Dynque<T>::enqueue(T val)
{
   if (isEmpty())
    front = rear = new QueueNode(val);
   else
   {
    rear->next =  new QueueNode(val);
    //
    // STATEMENT BELOW TO ASSIGN THE NEXT VALUE AT THE REAR TO NEW REAR.
   rear = rear ->next;
   }
   numItems++;
}
//
// define "dequeue" function
template <class T>
void Dynque<T>::dequeue(T &val)
{
    QueueNode *temp;
    //
    if (isEmpty())
    {
         cout << "The queue is empty.\n";
         exit(1);
      }
    else
    {
       val = front->value;
       temp = front;
       //
       // STATEMENT BELOW TO ASSIGN THE NEXT VALUE AT THE FRONT TO NEW FRONT.
       front = front ->next;
       delete temp;
       numItems--;
     }
}
//
// define "isEmpty" function
template <class T>
bool Dynque<T>::isEmpty()
{
   if (numItems)
     return false;
   else
     return true;
}
//
// define "clear" function
template <class T>
void Dynque<T>::clear()
{
   T value;        // Dummy variable for dequeue
   while(!isEmpty())
    dequeue(value);
}
// ********* End of queue structure *************
//
int main()
{
    // STATEMENT BELOW TO DECLARE A STACK NAMED DynStack TO CONTAIN
    // float VALUES.
    float DynStack;
    Dynque<float> queue;
    float catchVar;
    float numbers = 0.0;
    int count = 1;
    // Demonstrate the stack
    //
    cout << "USING A DYNAMIC STACK.\n\n";
    //
    cout << "Input three numbers in a stack.\n\n";
    while (count <= 3);
    {
          cout << "Enter a number " << count << ": ";
          cin >> numbers;
          //
          // STATEMENT BELOW TO ADD THE NUMBER ENTERED TO THE STACK.
         DynStack.enqueue(numbers);
          count = count + 1;
          }
     //
     cout << "\nRemoving the numbers from the stack.\n\n";
     count = 1;
    //
    while(count <=3)
    {
        //
        // STATEMENT BELOW TO REMOVE A NUMBER FROM THE STACK.
        DynStack.dequeue(numbers);
        cout << catchVar << endl;
        count = count + 1;
}
     //
     cout << "\n\nUSING A DYNAMIC QUEUE.\n\n";
    //
    count = 1;

          //
          // STATEMENT BELOW TO ADD THE NUMBER ENTERED TO THE QUEUE.
DynStack.enqueue(numbers);
          count = count + 1;
          }

    //
     cout << "\nRemoving the numbers from the queue.\n\n";
   //
    while (!queue.isEmpty())
    {
        // STATEMENT BELOW TO REMOVE A NUMBER FROM THE QUEUE.
        DynStack.dequeue(numbers);

        //
        //  STATEMENT  BELOW TO OUTPUT THE NUMBER THAT WAS REMOVED.
        cout << dequeue(numbers);

    }
    cout << "\n\n";
    system("pause");
}    return 0;
}

You haven't defined the Stacknode class, but are trying to instantiate constructors and other methods inside the template Dynstack class. This is not valid C++ code, at least to my knowledge.

Thank you! I fixed it! I started it over again.

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.