This code will be in C++ and will have 3 files. This lab will test your ability to use a custom stack class and a custom queue class. It will also test your ability to use a standard algorithm from STL. ReOrder ReOrder() takes three arguments as shown in Reorder.cpp. Complete this function using stack and queue. The number 0 is used as a delimiter between sets of numbers. The new array should have all negative numbers on one side and all positive numbers on the other side. The zero should be pushed to the end of the array. See the sample run below. Custom Compare Function The custom compare function is used in conjunction with the standard sort function. The numbers to be sorted are of a standard data type but create this custom compare function anyway. The function should result in a sorted array from the greatest number to the least number. Sample Run A sample run is as follows: array: -3 2 -1 5 1 -4 0 11 12 13 -11 -12 0 -1 -2 6 8 7 newArray: -3 -1 -4 1 5 2 -11 -12 13 12 11 -1 -2 7 8 6 0 0 newArray sorted: 13 12 11 8 7 6 5 2 1 0 0 -1 -1 -2 -3 -4 -11 -12   Be sure to document your code with the file name, your name and student number. Add comments throughout the code where necessary.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 16PE: The implementation of a queue in an array, as given in this chapter, uses the variable count to...
icon
Related questions
Question

This code will be in C++ and will have 3 files.

This lab will test your ability to use a custom stack class and a custom queue class. It will also test your ability to use a standard algorithm from STL.

ReOrder

ReOrder() takes three arguments as shown in Reorder.cpp. Complete this function using stack and queue. The number 0 is used as a delimiter between sets of numbers. The new array should have all negative numbers on one side and all positive numbers on the other side. The zero should be pushed to the end of the array. See the sample run below.

Custom Compare Function

The custom compare function is used in conjunction with the standard sort function. The numbers to be sorted are of a standard data type but create this custom compare function anyway. The function should result in a sorted array from the greatest number to the least number.

Sample Run

A sample run is as follows:

array: -3 2 -1 5 1 -4 0 11 12 13 -11 -12 0 -1 -2 6 8 7
newArray: -3 -1 -4 1 5 2 -11 -12 13 12 11 -1 -2 7 8 6 0 0
newArray sorted: 13 12 11 8 7 6 5 2 1 0 0 -1 -1 -2 -3 -4 -11 -12

 

Be sure to document your code with the file name, your name and student number. Add comments throughout the code where necessary.

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Stack
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT