Design a stack class using an array

Assignment Help Computer Engineering
Reference no: EM133324824

Assignment: Create a stack class that will he used as the basis for the remainder of the lab.

1. Create a new project.

2. Design a stack class using an array.

This class should he a template. a. h. C. [D i. The constructor should include a parameter to indicate the size of the array. The array holding the data should he an array of pointers. The push function should accept a pointer and add that pointer to the top of the stack. It doesn't need to create any memory. The pop function should return a pointer. It doesn't need to delete any memory. The top function should return a pointer to the item on the top of the stack widiout removing it. The length function will return an int indicating the number of items in the stack. The empty function should empty the stack of all contents. It needs to call delete to avoid memory leaks. It doesn't need to return any value. The stack should declare a friend function that can access the underlying array for the purposes of printing it to the screen. Create the implementation code for the above functions as required. Do not use cout in the class. Any errors such as overflow or under?ow should dirovv a custom class error.

Reference no: EM133324824

Questions Cloud

Define appropriate behavior : How do you define appropriate behavior? Why do you think it is important to have an effective classroom management plan?
Provide a requirements list to support the privacy : Project Management planning and Requirements Specification (PTS1, RKC3, RKC4, PS6) Provide a Requirements List to support the Privacy and Preferences
Describe an o(n log n)-time algorithm for determining : Let C be a collection of n horizontal and vertical line segments. Describe an O(n log n)-time algorithm for determining whether the segments in C form a simple
Create a schedule task which restarts a service : Create a schedule task which restarts a service of your choice. Add a write-host command that includes your name. Your message may be anything
Design a stack class using an array : The constructor should include a parameter to indicate the size of the array. The array holding the data should he an array of pointers.
What is the importance of review, final review : What is the importance of 50% review, Final Review, Strategy, and Tactical Workshop, and Debriefing, and Next Steps When you are ready to deliver a research
State diagram for the three phases of tcp connection : State diagram for the three phases of TCP connection. List the states shown in the diagram. The TCP connection can be closed simultaneously by both sides.
Write a method that takes an int argument : Write a method that takes an int argument. The method uses random letters to create and return a word. The number of letter in the word is specified
What is computer forensics and how is it used : What is computer forensics? How is it used? What are some of the challenges in the field of computer forensics? Post your answers to these questions and include

Reviews

Write a Review

Computer Engineering Questions & Answers

  List the calls to quicksort and partition in the order

Trace the quick sort algorithm as it sorts the following array into ascending order. List the calls to quickSort and partition in the order in which they occur.

  Describe the business process and it outsourcing

The BEST PRACTICE PRESENTATION can be chosen from one of the following topics: Business process and IT outsourcing, Collaboration tools.

  Find the names of all employees working in a department

Find the names of all employees working in a department managed by 'Smith'. Find the names of employees who have worked in every department.

  What networks were encountered along the way

What information about the geographic locations of the routers can you infer from the trace? What was the longest mean delay on any one hop along the way?

  Write down a program which compute the average of a group

write a program that calculate the average of a group of test scores where the lowest score is dropped. it should use

  Identify preventive measure for each type of threat category

Assume that you have been hired by a small veterinary practice to help them prepare a contingency planning document. The practice has a small LAN with four.

  Write a procedure that performs simple encryption

Write a procedure that performs simple encryption by rotating each plaintect byte a varying number of positions in different directions.

  Compute a closed-form distribution over the parameters ?

Specifically, your algorithm should sample the response variables U and compute a closed-form distribution over the parameters ?.

  Write a c program that forks a child process

Write a C program that forks a child process that ultimately becomes a zombie process. This zombie process must remain in the system for at least 10 seconds.

  How each policy you suggest will help mitigate attacks

The following scenario is based on an actual attack deconstructed at a seminar. The names and locations have been removed to preserve the privacy.

  Describe the general physical inspection phase

Fire is one of the most devastating elements that can destroy the physical components of an entity quickly. Explain some of the fire protocols that should be.

  Values of the cf and of

assume that EAX contains a given contents before the instruction is executed, and give the contents of EAX as well as the values of the CF, OF, SF, and ZF flags after the instruction is executed:

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