Category : Recently Uploaded Files
Archive   : HEADZIP.EXE
Filename : CSTACK.CPP

 
Output of file : CSTACK.CPP contained in archive : HEADZIP.EXE
//----------------------------------------------------------------------
// IMPLEMENTATION FILE (cstack.cpp)
// This module exports an ADT for a stack of characters.
// Stack representation: a vector.
//----------------------------------------------------------------------
#include "cstack.h"

// Private members of class:
// int top; // Subscript of current top item (or -1 if
// // stack is empty)
// char data[MAX_LENG]; // Vector representing the stack
//
// CLASSINV: -1 <= top < MAX_LENG

CharStack::CharStack()
//..................................................................
// Constructor
// POST: top == -1
//..................................................................
{
top = -1;
}

Boolean CharStack::IsEmpty() const
//..................................................................
// POST: FCTVAL == (top == -1)
//..................................................................
{
return (top == -1);
}

Boolean CharStack::IsFull() const
//..................................................................
// POST: FCTVAL == (top == MAX_LENG-1)
//..................................................................
{
return (top == MAX_LENG-1);
}

void CharStack::Push( /* in */ char newItem )
//..................................................................
// PRE: top < MAX_LENG-1 && Assigned(newItem)
// POST: top == top + 1
// && data[top+1] == newItem
//..................................................................
{
data[++top] = newItem;
}

char CharStack::Top() const
//..................................................................
// PRE: top >= 0
// POST: FCTVAL == data[top]
//..................................................................
{
return data[top];
}

void CharStack::Pop()
//..................................................................

// PRE: top >= 0
// POST: top == top - 1
//..................................................................
{
top--;
}


  3 Responses to “Category : Recently Uploaded Files
Archive   : HEADZIP.EXE
Filename : CSTACK.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/