Question: You will implement a C + + program to add integers into a dynamic array class that you will create. You must use a dynamic
You will implement a C program to add integers into a dynamic array class that you will create. You must use a dynamic array class no vectors or other containers You will also need to create recursive functions inside that dynamic array class based on the commands given in the command file. This homework will focus on dynamic array implementation and recursive techniques. When submitting this assignment, please name the folder on the server as hw
Input Files
The input file will have the size of the array on the first line and a list of integers separated by a comma on the second line.
Example input:
While reading the input, In and backslash r should be removed before processing the string of integers.
Command Files
There will be types of commands you will have to implement as functions in your dynamic array class. These must be recursive. They are: AddNums, FindNum, Replace, IsSorted, Print.
AddNumsindex
The AddNums command will be followed by an integer inside the parenthesis representing the number of first elements you should add For example:
text Array
AddNums should output to the output file as
If the Index should be outputted as we are adding the first elements.
If the index size of the array, "Invalid index" should be outputted.
FindNumtarget
The FindNum function should output "true" or "false" depending on if the target element is inside the array.
Replacevalue newvalue
The Replace function replaces "value" in the array with "newvalue". If "value" is not found in the array, output value is not in the array" view example section below
For example:
Array
Replace
text Array
IsSorted
The IsSorted function outputs "true" or "false" depending on if the array was input sorted or not.
Print
The Print function prints the array to the output file. This will need to be the same as when inputted in the input.txt file. see example below
Example:
The command file can be empty
While reading the command file, In and Vr should be removed before processing the string.
Output Files
The output file must match exactly with the answer file for credit to be awarded. Be sure to check for small things like leading spaces and newline characters.
Input file contents example:
Command File example:
AddNums
AddNums
IsSorted
Replace
Expected Output File For this Example:
Invalid index
false
is not in the array
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
