Code to implement a staque

Assignment Help C/C++ Programming
Reference no: EM1353323

Create a data structure called "Staque" which can store only integers. The way Staque works is as follows:

1) If the number that you are trying to store in the Staque is even, it is pushed in front of the Staque

2) If the number that you are trying to store in the Staque is odd, it is pushed at the end of the Staque

3) When you try to remove a number from the Staque, you always do it from either the front or from the back of the Staque following the LIFO rule.

Write a C++ code to implement a Staque. Since the data structure is all about inserting and deleting numbers, it would be a good option to use a linked list to implement Staque. Here's how your user interface should like:
Insert the numbers 1, 3, 2, 4, 6, 8 9 in the Staque.

Display the Staque: This is how the Staque will look like given that the above numbers were pushed in the Staque in the order given above: (front) 8 6 4 2 1 3 9 (back) Delete 2 even numbers and 1 odd number from the Staque and then display the Staque:

Since deletion always follows the LIFO order, the numbers to be removed are 8 first and then 6(the 2 even numbers) and 9(odd) from the back of the Staque. The Staque shall then look like: (front) 4 2 1 3 (back).

Run you program for at least 3 different input series & corresponding 3 different removal series.

Reference no: EM1353323

Questions Cloud

Company culture creation by management and employees : To what extent is a company's culture the creation of the management, and to what extent is a company's culture the creation of the employees?
Identify key areas of accounts receivable management : Analyse whether the proposed changes in credit policy should be accepted. Identify and discuss die key areas of accounts receivable management.
Explain a brand for which you feel strong loyalty : Explain a brand for which you feel strong loyalty (Heinz ketchup) and What has earned this particular brand its equity versus others in its market space?
Apple and microsofts corporate culture : Evaluate how each corporate culture differs from the other and analyze three ways that each unique culture has benefited by the other's competition.
Code to implement a staque : Write a C++ code to implement a Staque. Since the data structure is all about inserting and deleting numbers, it would be a good option to use a linked list to implement Staque.
Illustrate what is the socially efficient number of portrait : What will be his economic profit. How much consumer surplus is generated each day at this price. Illustrate what is the socially efficient number of portraits.
What height did the student fall : A student (m= 75 kg) falls freely from rest and strikes the ground. throughout the collision with ground, he comes to rest in a time of 0.040 s. the average force exerted on him by the ground is +18 000 N.
National culture and heterogeneous nation : National Culture, Heterogeneous Nation, and Perceptual Gap - Hofestede's research indicates that national cultures exist. Do you believe that in a heterogeneous nation, such as the United States

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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