C
C#2y ago
Darma

❔ Working w/ 2D Arrays

Hey all, new to the server and programming in general. Working on an assignment going over 2D Arrays. I'm currently trying to get the user's row and column input, find the specified index in the array, and print the new modified array, how should I go about doing this?
9 Replies
rhymbit
rhymbit2y ago
Where are you having problems? In traversing the 2d array? Here's something you should definitely try, create functions to do the small things that your code does. Like a function to take user inputs, another function to traverse the array, another function to modify an item inside the array.
Darma
DarmaOP2y ago
BlazeBin - nahnddtmyidt
A tool for sharing your source code with the world!
rhymbit
rhymbit2y ago
While writing these functions, you yourself will get an understanding of what parameters these function should take and what values should these functions return. This approach will help you organize your code more better and make things cleaner
Darma
DarmaOP2y ago
Ah ok then.
rhymbit
rhymbit2y ago
It's sort of called "Separation of concerns" i.e. you're separating .... concerns ... in separate code blocks nervousowo
Darma
DarmaOP2y ago
Another problem I've had (I had deleted the code before asking this question), was properly formatting the 2D array when I print it out. Especially when the values themselves are greater than column/row #
rhymbit
rhymbit2y ago
A separate function to properly format the array see where I'm going with this catlul you create functions to do separate stuff you can focus on main logic first, and work on formatting like things later Basically divide the entire problem in smaller chunks and try creating a separate function for each of those smaller chunks
Darma
DarmaOP2y ago
ok
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server