## afg_91320

im gonna make a program that will create a 2d array that will have test data.
its should have 8 rows and 10 columns and set seed of random generator to 11. (numbers should go from 0.0 to 99.9)
the rows and columns should have random numbers and must be able to:

print the sum of each row/column
print the average for all numbers
print the total for all numbers
print the highest and lowest for each row/column
get the highest value in the 2d array and be able to indicate where it is (row, column)
get the lowest value in the 2d array and indiciate where it is
print the entire array again so user can double check info

*note: the rows and columns cannot be fixed-i should be able to change the numbers in the code without any trouble (ex: change 8 rows to 6 and 10 cols to 2)

these are the functions i am going to use:
void fill2Darray
void print2Darray
double getTotal
double getRowTotal
double getAverage
double getColTotal
double HighestInRow
double HighestInCol
double LowestInRow
double LowestInCol
double getHighest
double getLowest

any idea on how i can get started guys?
ps-im workin on a rought layout right now, so ill post some of my progress in a bit

## Narue 5,707

>any idea on how i can get started guys?
Remove extraneous features from the definition until you have the minimum required core of the program. That should simplify your task considerably, and you can add features as you verify that what you've already written is working correctly.

^^got it

## afg_91320

how do i write the functions for the highest and lowest for each column/row?

note: the code itself should be able to run if i change the num of rows/cols

## DemonGal711 8

I'm assuming the value for the col and row is defined somewhere when the program is running (by user input or something like that). If that is the case, finding the max and min would be easy.

Basically, you are using two for loops for each case. Take what I have below, put the right parts inside the right for loops, and it should work fine.

``````float min = -1.0;
float max = 100.0;

if (min > array[x][y])
{ min = array[x][y]; }
if (max < array[x][y])
{ max = array[x][y]; }``````

You need to remember to take out the values and save them elsewhere before moving to the next row/col. I bet you can handle the rest of it.

## afg_91320

^^the cols are NOT going to be defined by user input. im actually writing all the functions separatly before i compile and run it together.

is there another method besides the one above?

## DemonGal711 8

Well, are the values for the cols and rows going to be defined somewhere, cause you'll need that to run the for loops.

If you don't want to do it together like that, you could do it all separately. Make one function that finds the min, have another that finds the max, and then just pass the values correctly so that each could be used for finding either the row or col values. You'll have to call each function every time you need a max or min though (that can be accomplished by a for loop).

In either case though, you are going to use if statements like the ones I gave you.