# Write two helper functions-one iterative (IsArrayPrimeIter) and one recursive (IsArrayPrimeRecur) each of which Take the array and its size as input params and return a bool.

INSTRUCTIONS TO CANDIDATES

Write the simplest C++ program that will demonstrate iteration vs recursion using the following guidelines -

1. Write two helper functions - one iterative (IsArrayPrimeIter) and one recursive (IsArrayPrimeRecur) - each of which
1. Take the array and its size as input params and return a bool.
2. Print out a message "Entering " as the first statement of each function.
3. Perform the code to test whether every element of the array is a Prime number.
4. Print out a message "Leaving " as the last statement before returning from the function.
5. Remember - there will be nested loops for the iterative function and there can be no loops at all in the recursive function. You will need to define other helper functions to make the recursive method work.
6. Remember - replace with the actual name of each function.
7. Hint - try to complete your iterative code first and then convert it piece by piece to the recursive code.
1. Ask the user for the number of elements, not to exceed SORT_MAX_SIZE = 16 (validate input).
2. Declare a dynamically allocated array of integers based on the size input provided by the user.
3. Get the input in a loop, validating that the integers input by the user are between 1 and 99, both inclusive
4. Make a call to the iterative function passing the array and its size.
5. If every member is a Prime, then the program should print out 'Prime Array using iteration', otherwise print out 'Not a Prime Array using iteration'.
6. Then make a call to the recursive function passing the array and its size.
7. If every member is a Prime, then the program should print out 'Prime Array using recursion', otherwise print out 'Not a Prime Array using recursion'.
8. If your functions are coded correctly, both should come up with the same answer, except you should have lots more output statements using recursion.
9. Remember to delete your array before the program exits.
3. There will be only one code file called Lab.cpp in your program.
4. Remember to take multiple screenshots so that they are clearly readable without needing to zoom in.
5. For documentation, including your name block as well pre/post and pseudocode for the two functions.
6. Upload your code file and the screenshots in one zip file. Do not include anything else.

• 25 pts - EXE works from as explained above without needing any code change
• 10 pts - for the main
• 15 pts - the IsArrayPrimeIter function
• 25 pts - the IsArrayPrimeRecur function
• 25 pts - following all instructions in Lab - General Submission Instructions carefully
1. Not including screenshots will result in a 10% penalty.
2. Not including pseudocode will result in a 20% penalty.
3. Not including pre/post headers will result in a 20% penalty.

## Related Questions

##### . Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

##### . The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

##### . Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

##### . SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

##### . Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Hire Me

Hire Me