Hello fellow programmers. I am trying to display a 2D array that displays randomly generated numbers that fill out in rows and columns. At the end of each row it should have the total and average displayed. I have written up all of the code and it compiles. I am not asking for the whole solution. Trust me, I have done my own work. I simply can't get the columns to display. I just have one long row. I have a header and tester file. Here is what my header file looks like. The area that I need help with is the function called "void MultiArray::display()"
This is my code.
#include <iostream>
#include <iomanip>
#include <cstdlib> // Needed to use rand() and srand()
#include <time.h> // Needed for time functions
using namespace std;
const int ROWSIZE = 10; // Number of elements in the array
const int COLSIZE = 5;
class MultiArray
{
private:
int data[ROWSIZE][COLSIZE]; // Array holding SIZE double values
public:
MultiArray(); // Constructor. Initialize all elements of data[] to 0
void randomFill();
int getRowSize();
int getColSize();
int getTotal();
int getRowTotal(int r);
double getAvg();
double getRowAvg(int r);
int getLargest();
int getSmallest();
int countValues (int lowRange, int highRange);
bool isNumberFound(int someNumber);
void display();
That helps me a lot. But I feel like my professor wants us to use the functions "getRowTotal" and "getRowAvg" inside our display function to show the total and average.