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

  Write a program that inputs a dollar amount to be printed

Write a program that inputs a dollar amount to be printed on a check and then prints the amount in check-protected format with leading asterisks if necessary

  Program to print out invalid number to character

The integer must contain 3 distinct non-zero number, or the program will print out invalid number.it should print out invalid query.

  Problems on oops

Problems on OOPS

  Write a driver program called testrationalnumber.cpp

Write a driver program called testRationalNumber.cpp to test each of the above functions and overloaded operators in the RationalNumber class.

  Implement a semantic analysis

The program will implement Semantic Analysis. The assignment provides two options to define variable scope, either using the Global Option or the Local Option.

  Represent an instruction supported by simpletron

Implementation contains a Simpletron class and several supporting Instruction classes

  Loops and if conditions

Write a program that requests a password

  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.

  Iterative programming problem solving approaches

Write a recursive function void reverse ( ) that reverse a sentence

  Write a c program that reads a data file of floating numbers

Write a program that reads a data file of floating numbers into an array and prints the array elements along with the number of items in the array

  Create a program that maintains the required book catalog

Create a program that maintains the required book catalog for the circulation desk of a library.

  Write a program that will be used to gather statistical data

Write a program that will be used to gather statistical data about the number of movies

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