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 matrix multiplication program

Write a C++, matrix multiplication program which you can instrument to monitor and measure execution time as a function of problem size. Make sure it works in Microsoft Visual Studio.

  Skills required by personnel working in information security

What skills are required by personnel working in information security? Write down some job titles in the field and come up with some required qualifications and some desirable qualifications.

  Structured programming using procedural languages

A a program that is called "Playing with Numbers or Letters".

  Prepare a program for a retail-mart company

Prepare a program for a company Retail-Mart.

  Design a nested program

How many levels of nesting are there in this design?

  Show the deatils of an emplyoee - c programming

Show the deatils of an emplyoee in a neat format.

  Computer programming techniques

Construct a program from a design and use appropriate functions

  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

  Write a menu-driven program that maintains an address book

Write a menu-driven program that maintains an address book using a linked list. The address book must supports the following operations

  Writing function that computes leap years

Write down function that computes leap years. Function prototype is as follows: Write function body which returns true if year is a leap year and false if year is not a leap year.

  Base process which communicate with child processes

Write a program which has a "base process" which communicates with child processes acting as "bombers" that it creates.

  Calculate the component voltages

Calculate the component voltages for the following series resonant RLC circuit

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