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 to calculate existing angles

Write a program to calculate existing angles and do if and then from this, and to place fixed angles at certain position.

  Program to next the loops in either direction

You can write your program to next the loops in either direction, that is, process row-by-row or column-by-column. Explain which way you would choose to process the data.

  Iterative programming problem solving approaches

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

  Write a program to read a data file and extract parameters

Write a C/C++ program to read a data file and extract parameters. The program must obtain the filename via a command-line argument.

  Prepare a program that uses at least two functions

Prepare a program that uses at least two functions that can be called from your main.

  Create program that uses functions and reference parameters

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

  C assignment of curl library

C Assignment Curl library must be used To be done on linux, it should be compiled using the following command: gcc -Wall -ansi -pedantic NameOfFile.c -lncurses Please make sure it is commented with clarification Variable names in camel case

  Time conversion

Write a C++ program that takes an Eastern standard time in hours, minutes, and seconds,and prints it out in Central time, Mountain time, or Pacific time.

  To reverse the order of elements on a stack

Write a program in C++ to  reverse the order of elements on a stack S using two additional stacks using one additional stack

  Design for storing the maze layout

Design and implement a C++ program for maze layout

  Create class integerset

Create class IntegerSet for which each object can hold integers in the range 0 through 100. Represent the set internally as a vector of bool values. Element a[i] is true if integer i is in the set. Element a[j] is false if integer j is not in the set..

  Create a base employee class

Create a base Employee class and a derived StudentEmployee class

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