0

Stuck in Arrays.

Been stuck with array for days now. kinda complicated to me. need help in here. Also, need project to ascertain my ability on variables, if, if else and else, loops. Did few to dirty my hands. I need more too.

2nd Sep 2018, 5:35 PM
Adison Ojieh
Adison Ojieh - avatar
4 ответов
+ 5
First of all, AFAIK 3D arrays are less likely used because they are difficult to handle and manipulate. 2D array is used when you have to store data for multiple values. Take an easy example of this, suppose you are given a task to create a program that stores the marks of students by their roll numbers. Since Roll no and Marks could be integers so create a 2D int array int noOfStudents = 50, noOfSubj = 7; int marks[noOfStudents][noOfSubj] = {0}; //Same as int marks[50][7] = {0}; Now there are 50 students whom marks we have to store for 7 subjects. This is a simple example to show that why and when do we need to create 2D array :)
2nd Sep 2018, 9:03 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 3
Can you elaborate more on what is troubling you with the arrays, if..else if, else and loops. It's kinda broad topic, maybe narrow it down a bit?. Try practice to use loops to print array elements, add a little if..else if condition checks to alter the output, e.g. increase elements on odd index, decrease elements on even index, something along that : )
2nd Sep 2018, 6:00 PM
Ipang
+ 1
for variables, if, else if and else, loop, I quite understand it clearly. indexing arrays, slicing arrays, using elements of an arrays, array dimensions. like when to know when an array is 2D or 3D... and so.
2nd Sep 2018, 8:43 PM
Adison Ojieh
Adison Ojieh - avatar
0
sorry nAutAxH AhmAd, how then will I manipulate the integers in this array. let say I want to get the subject for 37th student. how will i do it?
2nd Sep 2018, 9:18 PM
Adison Ojieh
Adison Ojieh - avatar