Resolved Help!! Need for today

Moriarty

New member
Joined
Mar 23, 2022
Messages
2
Programming Experience
Beginner
Help me pls
Screenshot_20220323_145458_com.android.gallery3d.jpg
 
Please post your code in code tags, not screenshots. Also please make you title more descriptive of what problem you have. Everyone who comes to this forum invariably needs help, but you are not giving us a short summary of what you need help with. Additionally, in your description, you need to tell us more than just "Help me, pls", and "After writing method it must be like this."

More often than not, if a person is unable to describe their problem in detail, it's the first sign that the person has not actually thought through the problem and just started slapping code on screen hoping something would work.
 
As a pointer, keep in mind that a jagged array is an array of arrays. When you index the outer array, you get one of the inner arrays. You then need to index that to get an element of that inner array. This:
C#:
jagArray[index].
is attempting to access a member of an int array. Is that what you want?

Also, should you be using a jagged array at all? The name comes from the fact that each inner array can be of a different length, so laying out the elements creates a jagged edge. If you want a matrix, i.e. a rectangular table of columns and rows, then you probably ought to be using a 2D array, which is declared differently:
C#:
int[][] jaggedArray;
int[,] twoDimensionalArray;
When you create a jagged array, you only have to know the size of the outer array. When you create a 2D array, you must know both dimensions, which may be the sticking point.
 

Latest posts

Back
Top Bottom