- +1-530-264-8006
- info@tutorsglobe.com

Create a function call sumarray which will return the sum

Assignment: Arrays Lab C++

This lab has several parts, each worth an equal amount of credit. Please put all three parts into one file. Title it (ArrayLab_Rameshwar Shrestha), and comment the code appropriately to distinguish different parts of the lab:

1) Create a function call sumArray which will return the sum of an array that is passed in. Note that a length of the array should also be specified.

input: arr={1, 2, 3, 4}, length=3

returns: 6 (because the 4 was ignored because it was past the length)

2) Create a function call convertToDecimal. This method will take an int array { 3, 2, 4 } and a length of the array, and will return a single integer where each part of the array is a digit in the new integer (324). To do this you will need to multiply:

3*10^2 +

2*10^1 +

4*10^0 = 324

add an optional parameter that allows it to take a base to multiply it to such as base 2 or base 8 (in the example I'm using base 10 of course).

3) Write a functionprintAccending, that will take an int array and the length as its input and output each integer on a line that is greater than the last. If one is smaller it will drop to a new line and continue from there:

input {2, 5, 8, 3, 9, 9, 7}

output:

2, 5, 8

3, 9, 9

7

4) Write a functionreverseArrayEven which will loop through a given array (with a size provided as well), and will reverse the digits if they are even numbers.

input: {1, 2, 4, 5, 6, 9, 10}

returns: {10, 9, 4, 5, 6, 2, 1}

5) Write a function to search a 2-dimentional array for a value. The method should take a reference to a row and col integer, and if the value is found then set the row and col variables accordingly. If the value is not found row and col should both equal -1. Note that lengths of the array should also be taken as input.

input: {{1,2,3},{4,5,6},{7,8,9}}, inputRow=3, inputCol=3, foundRow&, foundCol&, searchValue=6

after function completes: foundRow = 1, foundCol=2

Format your assignment according to the following formatting requirements:

1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.

2. The response also include a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.

3. Also Include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.

Now Priced at $40 (50% Discount)

Recommended **(97%)**

18,76,764

Questions

Asked

21,311

Experts

9,67,568

Questions

Answered

Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!

Submit Assignment
## Q : When formulate the code for this stating c nm1 it is not

question sample input n4m2samle output is 7explanation 421 ie for 4 wrappers we get one chocolate so 41 and he has 2