Implementation of the stack class in c++, C/C++ Programming

Assignment Help:

Implementation of the Stack class in C++:

How to implement stack class in c++.

int Stack::push(int elem)

{

   if (top < nmax)

   {

      list[top++] = elem;

      return 0;

   }

   else

      return -1;

}

 

int Stack::pop(int& elem)

{

   if (top > 0)

   {

      elem = list[--top];

      return 0;

   }

   else

      return -1;

}

 

void Stack::print()

{

   for (int i = top-1; i >= 0; --i)

      cout << list[i] << "\n";

}


Related Discussions:- Implementation of the stack class in c++

Compiling/ installing openvpn client within an ip camera, Project Descripti...

Project Description: I want someone with experience on adding/compiling/installing the OpenVPN client software within an IP network camera's embedded operating system. Either if

Define the system oriented data files, Define the System Oriented Data File...

Define the System Oriented Data Files? System-oriented data files are further closely related to the computer's operating system than Stream- oriented data files and they are s

#title, Given an integer n and a permutation of numbers 1, 2 ... , n-1, n w...

Given an integer n and a permutation of numbers 1, 2 ... , n-1, n write a program to print the permutation that lexicographically precedes the given input permutation. If the given

Difference between mutex and binary semaphore, Semaphore is used to synchro...

Semaphore is used to synchronize processes. whereas mutex is used to give synchronization among threads running in the similar process.

What is memory allocation, What is memory allocation? Memory Allocation...

What is memory allocation? Memory Allocation : It is the method of allocating memory storage to program in such that the program can be run.

.C# mouse and maze program, .Create a Csharp solution that will show a maze...

.Create a Csharp solution that will show a maze in the user interface and will show a mouse walking through the maze attempting to locate the exit door (the cheese).

Sizeof() operator, What is the specialty in sizeof() operator

What is the specialty in sizeof() operator

Palindrome, A palindrome is a string that reads the same from both the ends...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Car rental system, complex coding with structure and file handling

complex coding with structure and file handling

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd