Hey Guys,
Im workin on an assignment to be handed over soon and Im really stuck with identifying sequence, selection and iteration in the following code. Could someone identify these three for me? And a simple explanation of why they are used in this instance would be greatly appreciated.
I don't understand what you mean by 'sequence' but I can help you with the last two.
selection: the code starting at line 182 and ending at 203 and any other if...else in your code. It's a "selection" because it selects from several cases (if(condition) <code> else <some_other_code>; and switch being just multiple if...else's)
iteration: to iterate means to go through every element of a structure and either look at it or do some operation on it. The code inside ExchangeSort(), calculateAverage(), calculateAboveAverage() and displaynames() does this.
@goth, thanks alot for the great help!
selection and iteration are clear enough for me. i simply didnt undrstand wat sequence was either. it was only mentioned in the question. dat doesnt matter.
Thank you very much for your help and time!!!! :)
Sequence is the most basic of all. It is simply a group of instructions which are executed in a linear fashion, one after another. The flow of control simply steps through the code one line at a time.