Hey guys, I'm pretty new to programming (started course just a few weeks ago) and I've hit a brick wall and I don't know how to bypass it. For an assignment I've been tasked to produce an array and populate it without having 5 individual statements that assign the 5 elements one by one, and I have to use a FOR loop all in pseudo code. I have to assign 10, 20, 30, 40 and 50 to the array. Sorry if this sounds so basic for you guys, I'm such a newb at this.
:/ So here's my latest attempt:
display "How many numbers do you want to store?"
get storage
declare numbers[storage]
for count = 0 to storage-1
get numbers[count]
endfor
display "The numbers you entered were"
for count = 0 to storage-1
display numbers[count]
endfor
I know it isn't correct because whenever I test it out in the Uni's interpreter it says that my array should be 5 in length and that the elements are undefined. I need to define the elements without tampering with them individually, I just can't figure it out. I've been looking around for some hints and tips but can't find any.
Could someone please help me out? I'd greatly appreciate some guidance with this :cry:
Question
Jellyicex
Hey guys, I'm pretty new to programming (started course just a few weeks ago) and I've hit a brick wall and I don't know how to bypass it. For an assignment I've been tasked to produce an array and populate it without having 5 individual statements that assign the 5 elements one by one, and I have to use a FOR loop all in pseudo code. I have to assign 10, 20, 30, 40 and 50 to the array. Sorry if this sounds so basic for you guys, I'm such a newb at this.
:/ So here's my latest attempt:
Link to comment
Share on other sites
2 answers to this question
Recommended Posts