Select Page

Answer & Explanation:Hello, I need help completing 4 C++ programs dealing with function and arrays (1D and 2D). He likes the use of comments throughout the program. The instructions for each program and data for each program is below. Most of these programs are to be output to files.
2d_array_workout_v4.doc

array.txt

arrayworkout_pgm_ix.doc

aryparams.txt

functionworkoutv5.docx

Unformatted Attachment Preview

CS 318
Program Assignment
2D Array Stuff
You are to write a program that will perform calculations with a two dimensional array. The
following functions are to be developed to support a new development initiated by a local MultiOptimal-Dimension Company (MAD COMP). Your program should handle any two dimensional array
up to 100 by 100. (Dimension your array 100 by 100) The user will supply you with the dimensions of
the array at the time your program starts running. If the user gives you as input 5 and 10, then you are
to process an array that is 5 rows and 10 columns, which is part of the 100 by 100 array you defined in
your program. If the user gives you 25 by 75, then you have an array 25 rows and 75 cols which is part
of the 100 by 100 array you defined in your program. You will only need one array for this program
(I will supply you a pseudo main program to test you code with.).
You are to development the following functions to support this effort. Write a function for each of
the following actions.
Add any two rows together, place results in the second argument (second row)
Subtract any two rows, (second row from first row )
place results in the second argument.
Add any two columns together, place results in the second argument.
Subtract any two columns, (second col form first col.)
place results in the second argument.
Copy one row replacing the second row: second row argument is changed
Find the largest number in any row.
Find the largest number in any column.
Find the smallest number in any row.
Find the smallest number in any column.
Get function that returns one value from the array get(ary,r,c).
Replace any element in the array with a new value
Ex call: Replace(array, r, c, newvalue)
Print out the array, one row per line. (yes for my test, a row will fit on one line.)
Put a blank between your values.
Example function:
Input: I will supply you a pseudo main program that will be used to test your functions. I will not
be able to give you the actual code, because I will not know the name of your routines or the order of
your arguments. You will write the main program to test your code.
CS 318
Program Assignment
2D Array Stuff
Pseudo Code
Restrictions: You must read in the dimension of the array. You cannot have any code in your main program
that has the [] syntax. Your declaration for the array in the main program can have [] and only there. Any and all
array manipulations must be done in the functions given earlier. This also includes any new functions you decide to
add to the program, ie the new functions cannot have [] syntax in them, just the functions stipulated in the program
specifications.
For the following, do the operations in the order given below.
Read in the size of the array to be the following:
Rows: 15, Columns: 15 Must be read in and not defined nor hard coded in your program.
In C++, this will be row 0 to row 14, but you can use row 1 to 15 and
ignore row 0 and col 0 if you would like.
1. Fill the array with the value 1 to 15 on the first row, 16 to 30
on the second row, 31 to 45 on third etc for all 15 rows.
Hint: This would look something like the following:
i=0;
for ( r=0; r