Question: Set up: 1) Create all functions and the main() in one single.cpp file Submission: Zipped file StudentID_Lab2, including: o cpp file. o screenshot of sample
Set up: 1) Create all functions and the main() in one single.cpp file Submission: Zipped file StudentID_Lab2, including: o cpp file. o screenshot of sample runs. Lab Questions: 1. Write a recursive function reverseNumber(n) for an integer number, e.g. 1234=>4321 2. Implement a magicIndex () function in an iterative way for an array of numbers A[0,1... 1), that returns the index such that A[i] = i, if one exists. Assume that a given array holds only distinct integers. 3. For the same question in task 2 above, implement a magicIndexRecusive() function in a recursive way. 4. Write a main() function that tests all the above functions, with two test cases for each function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
