I'm trying to store these arrays into the matrix

double X[5][3]

so I could classify them with 1 Nearest Neighbour:

double brick_v[3]={ent_brick,en_brick,con_brick};
	double metal_v[3]={ent_metal,en_metal,con_metal};
	double skin_v[3]={ent_skin,en_skin,con_skin};
	double wood_v[3]={ent_wood,en_wood,con_wood};
	double grass_v[3]={ent_grass,en_grass,con_grass};

I would be very grateful if someone would show me how you can do this in C++.

Recommended Answers

Not sure how you accept the input... Do you mean you currently have 5 variables which are arrays size of 3 and you want to instead use a 2D array? If so, you need to simply change the way you accept values and place each value into the new 2D …

Jump to Post

All 2 Replies

Not sure how you accept the input... Do you mean you currently have 5 variables which are arrays size of 3 and you want to instead use a 2D array? If so, you need to simply change the way you accept values and place each value into the new 2D array correctly.

It's certainly possible to put data into multi-dimensional arrays, but there is not enough information here to get a good grasp of the problem you're trying to solve.

Where is the data coming from and how do you intend to use it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.