Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(Instruction: You have to answer all the questions in the given code file. After completing your answer, at first zip the folder that contains your
(Instruction: You have to answer all the questions in the given code file. After completing your answer, at first zip the folder that contains your project in Desktop, then rename the zip file with your name \& id, and then submit it in google classroom within this 50 mins.) 1. Create a Project named "Lab Final" in Desktop. Then convert the codes of "main.cpp" (of both StackLinkedList and QueueLinkedList which are provided) to create two separate classes "StackClass" and "QueueClass" which will be in the project you created. (10 marks) (When you are done with Q1, stackclass.h and queueclass.h will be in the Headers of the project, stackclass.cpp and queueclass.cpp will be in the Sources of the same project. This header files will contain the variables, functions, constructor, structure etc., and the source files will only contain the function and constructor bodies.) 2. Reversing the first N elements of a Queue in main.cpp. (20 marks) Given an integer N and a queue of integers, we need to reverse the order of the first N elements of the queue of 10 integers, leaving the other elements in the same relative order. For this task, you can't use other than the "StackClass" and "QueueClass" that you created. Sample 1: Input: Q=[10,20,30,40,50,60,70,80,90,100] N=5 Output: Q=[50,40,30,20,10,60,70,80,90,100] Sample 2: Input: Q=[10,20,30,40,50,60,70,80,90,100] N=0 Output: Q=[10,20,30,40,50,60,70,80,90,100] 3. Write a recursive function pow(int a, int b ) in main.cpp to calculate ab; a is the base, b is the power. (10 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started