hi guys i really need some help. Im trying to turn my index array into a multidimensional array and cant get it to compile. thanx for the help.
include <iostream>
using namespace std;
#include <cstdlib>
#include <cstring>
#include <iomanip>
const int LIMIT = 10;
const int MAX = 10;
class Matrixarray
{
private:
double myarray[LIMIT][MAX];
public:
void putel(int n,int j,int val)
{
if (n <0 || n>=LIMIT)
{
cout << "OUT OF BOUNDS";
myarray[n] = val;
}
if ( j <0 || j>=MAX)
{
cout << "OUT OF BOUNDS";
myarray[j] = value;
}
double getel(int n, int j)const
{
if(n<0 || n>=LIMIT)
{
cout << "OUT OF BOUNDS";
return myarray[n];
}
if(j<0 || j>=MAX)
{
cout << "OUT OF BOUNDS";
return myarray[j];
}
}
}
};
int main()
{
Matrixarray ma1;
for (int j=0; j<LIMIT; j++)
ma1.putel(j, j*10);
for (int j=0; j<LIMIT; j++)
{
int temp = ma1.getel(j);
cout << "Your Element: " << j << "is" << temp << endl;
}
return 0;
}