Question: Consider the following statements using the classes linkedStackType and linkedQueueType introduced in Chapters 7 and 8 : linkedstackTyperint> stack; linkedQueueType queue; int num; Suppose the

 Consider the following statements using the classes linkedStackType and linkedQueueType introduced

Consider the following statements using the classes linkedStackType and linkedQueueType introduced in Chapters 7 and 8 : linkedstackTyperint> stack; linkedQueueType queue; int num; Suppose the input is 283015111092183331714 Fill in the underlines below to complete a C++ code that processes these numbers as follows: 1. If the number is an even number, it is pushed onto the stack. 2. If the number is odd and divisible by 3 , it is added into the queue; 3. Otherwise the top element, if any, of the stack is removed and the square of the number is added onto the stack. After processing these numbers, what is stored in stack and queue? Answer: cin num; while (cin) \{ switch (1) 1 case 0: // The number is even. break: ; // step 1 case 1: case -1 : // The number is odd. if (__// The number is divisible by 3 . else ;// step 2 \{ if (__) // The stack is not empty. // step 3 3 \} //end switch ain num; \} //end while After processing these numbers, stack and queue are

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!