Hello.. I am stuck on how to get this started. Below is the prompt.
Next, you will create another array. This third array has 4 elements, each of which is an array of integers (an array or arrays). Each of the member arrays of ints is the same size as your data set (50) because it's possible (though very very unlikely) they could hold as many data as the data set size. Each of these 4 arrays represent categories of the data. The first of the member arrays is the indexes of the data set that are penguins with neurosis levels in the interval [1.00, 4.00); the second for neurosis levels in [4.00, 6.00); the third for the interval [6.00, 8.00), and the last for the interval [8.00, 10.00]. NOTE: [a, b) means include a, but upto and not b.....inclusive of lower end point and exclusive of upper end point. So, now you will fill those arrays appropriately with the indexes of the penguins taken from the data set.
My question is, is there a way to categorize an array based on these parameters? Thanks in advance
This is only a minor complication of previous assignments. It tricks you by being an “array of arrays”, but that isn’t really different than four separate arrays:
1 2 3 4 5 6 7 8 9
int penguins1_to_lt_4 [MAX_PENGUINS];
int penguins4_to_lt_6 [MAX_PENGUINS];
int penguins6_to_lt_8 [MAX_PENGUINS];
int penguins8_to_lt_10[MAX_PENGUINS];
int num_penguins1_to_lt_4 = 0;
int num_penguins4_to_lt_6 = 0;
int num_penguins6_to_lt_8 = 0;
int num_penguins8_to_lt_10 = 0;
Only now you have:
1 2
int penguins[4][MAX_PENGUINS];
int num_penguins[4] = { 0 };