0

Array user input

how would I go about allowing a user to input what values in an array to print, from any point, and the following 24 values.

22nd Nov 2017, 1:35 AM
Roguesquid
Roguesquid - avatar
3 Answers
+ 1
You have to use the Console class to read the index of the first element that you want to print out. After that, with a (possibly) for-cycle, you have to go from that index to "index + 24" with the cycle variable and write out the desired value from the array by indexing it with that variable. I wrote a sample code, hope it helps and this answers your question. https://code.sololearn.com/cDGl800NlCyl/?ref=app
22nd Nov 2017, 3:27 AM
OWRhcmFidQ==
+ 1
Since indexing starts from 0 instead of 1, the n-th element is at the (n-1)-th position.
23rd Nov 2017, 1:38 AM
OWRhcmFidQ==
0
slightly related, would the index of the 201st value in the array be at position 200 in the array, or 202. i.e does the index shift back one
22nd Nov 2017, 10:11 AM
Roguesquid
Roguesquid - avatar