19 3 5 Write a program that repeatedly gets integer input from the user until the value 99999 is entered. The program must then print the values the user entered alternating between odd and even values starting with the first odd value as in the examples below. The odd and even values must respectively be in the order they were entered but the overall output will not necessarily be in the order entered. 7 If more odd or even values were entered, the program should continue to print the remaining values after all other odd/even values have been printed in the order they were entered. Input Note: You must use Queues to solve this problem: an implementation of the Queue class is given - you do not need to provide your own. You will have the following methods available from the Queue class: Queue), enqueue, dequeue, -peek), len(), and is_empty() Note: You must NOT access private data fields of the Queue class, you must NOT create any other built-in collections (e.g. lists, tuples, sets, dictionaries, etc) For example: 2 8 199999 Enter a number: 9 Enter a number: 3 Enter a number: 5 Enter a number: 7 Enter a number: 2 Enter a number: 8 Enter a number: 99999 9 2 4 m 00 i 3 8 Result 5
19 3 5 Write a program that repeatedly gets integer input from the user until the value 99999 is entered. The program must then print the values the user entered alternating between odd and even values starting with the first odd value as in the examples below. The odd and even values must respectively be in the order they were entered but the overall output will not necessarily be in the order entered. 7 If more odd or even values were entered, the program should continue to print the remaining values after all other odd/even values have been printed in the order they were entered. Input Note: You must use Queues to solve this problem: an implementation of the Queue class is given - you do not need to provide your own. You will have the following methods available from the Queue class: Queue), enqueue, dequeue, -peek), len(), and is_empty() Note: You must NOT access private data fields of the Queue class, you must NOT create any other built-in collections (e.g. lists, tuples, sets, dictionaries, etc) For example: 2 8 199999 Enter a number: 9 Enter a number: 3 Enter a number: 5 Enter a number: 7 Enter a number: 2 Enter a number: 8 Enter a number: 99999 9 2 4 m 00 i 3 8 Result 5
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section: Chapter Questions
Problem 9PP
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 3 images
Knowledge Booster
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.Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning