Float array

Hi,

I need another class to be able to access the value of floats inside an array with a get and set function

the array contains 60 elements 6 rows and 10 columns.

void setarray(temp[i][j], i , j);
float getarray(temp[i][j], i, j);

could somebody please give me an example i would greatly appreciate it.

closed account (o3hC5Di1)
Hi there,

your class declaration would look like this, hopefully that can get you started:

1
2
3
4
5
6
7
8
class Floatarray {
    private:
        float myfloatarray[6][10];

    public:
        void set_element(int, int);  //(int row, int column)
        float get_element(int, int); // "
};


This way you can create a "Floatarray" object and manipulate it with the getter and setter function - which you'll still have to define.

Hope that helps.

All the best,
NwN
i was struggling in passing the array to the function.
i just needed to pass the index not the array itself.

thanks that helped alot.
Topic archived. No new replies allowed.