Question: Due date: 1 1 : 5 9 pm , Oct 1 1 , 2 0 2 4 This is an individual assignment. Part of the
Due date: :pm Oct
This is an individual assignment. Part of the assignment will be graded automatically. Make sure that your code compiles without warningserrors and produces the required output. Also use the file names and structures indicated as requested. Deviation from that might result in mark.
Your code MUST compile and run in the CSIL machines using the steps covered in class see the Before You Submit section for details It is possible that even with warnings your code would compile. But this still indicates there is something wrong with you code and you have to fix them, or marks will be deducted.
Your code MUST be readable and have reasonable documentation comments explaining what it does. Use your own judgement, for example, no need to explain i is increasing i by but explain how variables are used to achieve something, what a certain loop is doing, and the purpose of each #include.
Description
There is a total of questions in this assignment. For each question, write your answer in a single file along with the required information stated in the question. Unless otherwise specified, do not include any preexisting libraries in your answers. You can however write your own helper functions. Also, do not print anything unless the question asks you to None of these files should contain the main function. except for Question
Question marks
Write a recursive solution that does exactly the same as what the function in Question of Assignment does. That is replaces a specific digit in an int number with another digit and returns the result as an int. Return the same number if the targetreplacement character is not a digit. Use this function header:
int replaceDigitsRecursiveint number, char target, char replacement
For example for more examples refer to the description in Assignment :
replaceDigitsRecursive should return
replaceDigitsRecursive should return
replaceDigitsRecursiveprime should return leading zeros will not be part of the resulting number
You can assume the number does not have leading zeros eg we will not call replaceDigitsRecursive except when the number is actually zero ie we might call replaceDigitsRecursive
This question aims to let you practice recursion. One way to do so is to look at your answer for Assignment separate the recursive case most likely where you use a loop from the base case most likely the last step you do before returning the result You should be able to see a significant simplification to your code. Do not use any global or static variables, or passbyreference if you do so you get for this question
Depends on how you solve this, you might have to create a recursive helper function that passes an extra parameter preserving the partial answer. IOnly include the aquestionh header file and the function definition and your helper functions, if any in the source file and name it as aquestionc
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
