• Join over 1.2 million students every month
• Accelerate your learning by 29%
• Unlimited access from just £6.99 per month
Page
1. 1
1
2. 2
2
3. 3
3
4. 4
4
5. 5
5

# Explain sequence, selection and iteration as used in computer programming; outline the benefits of having a variety of data types available to the programmer.

Extracts from this document...

Introduction

Code Structure Task Brief * As Gary is fascinated about computer software, he would also like you (a) to explain sequence, selection and iteration as used in computer programming; (b) outline the benefits of having a variety of data types available to the programmer. Contents Task Brief 1 Introduction 1 Sequence Flow 1 Selection / Decision Flow 2 Iteration / Repetition Flow 3 Summery 5 Bibliography 5 Introduction In this report, I shall seek to explain how sequence, selection and iteration are used in computer programming. In order to do so, it first needs to be understood that they are all control structures, and as such are used to help dictate how a program should flow. Sequence Flow In a sequence control structure, statements are processed consecutively, from first to last, with no deviation. No decisions or comparisons have to be made with data, so the program simply runs the instructions and, once the last statement is completed, terminates. The following diagram illustrates this process as a flowchart: (The VB Programmer LLC, 2006) In order to illustrate how this flow appears in practicality, the following is a program I have written in Visual Basic to help illustrate this. ...read more.

Middle

In this case, it prints "That's a big number!" on the screen. * If this is not to the affirmative, it is instructed to follow the else clause, which starts at step 11 and continues onto step 12. In this case it prints, "That is not a big number..." on the screen. * Finally, the end if stated in step 13 encapsulates and signals the end of this process, and the program is allowed to continue processing the instructions as a sequence in step 14. (The VB Programmer LLC, 2006) Iteration / Repetition Flow Instructions are repeated in a loop. The loop can be either a fixed repeat loop (where the loop repeats a specified number of times) or a conditional loop (where the loop will continue until a certain condition has been met). The syntax for implementing these two scenarios differs in Visual Basic, but the basic idea of repeating code until an objective has been completed is the same. The following diagram illustrates this process as a flowchart: (The VB Programmer LLC, 2006) This diagram is simplified to be able to account for both kinds of loops, but the general idea is the same. ...read more.

Conclusion

* The value of total is overwritten by the sum of numbers and the existing value of total in step 8 * The value of counter is overwritten by the sum of 1 and the existing value of counter in step 9 * The program prompts the user in step 10 to enter a number, or to enter X to begin calculating the average of all numbers enters by the user * The user's input is recorded into the numbers variable in step 11 * Finally, this loop statement in step 12 instructs the program that the end of the loop has been reached, and to go back to the beginning of the loop at step 7 Summery In this report, I presented how the control structures sequence, selection and iteration are used in computer programming. We learned that the sequence structure processes instructions in a linear fashion to its conclusion. In regards to selection, we learned that it allows us to create two or more different paths for a program to follow by setting criteria. Finally, we learned that loops allow sections of code to be run either a predetermined or unset number of times, depending on the aim of the loop. ...read more.

The above preview is unformatted text

This student written piece of work is one of many that can be found in our AS and A Level Computer Science section.

## Found what you're looking for?

• Start learning 29% faster today
• 150,000+ documents available
• Just £6.99 a month

Not the one? Search for your essay title...
• Join over 1.2 million students every month
• Accelerate your learning by 29%
• Unlimited access from just £6.99 per month

# Related AS and A Level Computer Science essays

1. ## LAN &amp;amp; Topologies &amp;amp; Data Flow

3 star(s)

On the other hand a mail server is used to store received and sent. A file server is completely different to the previous one's because this actually is made to only store files and let users download them at very high speeds.

2. ## Principles of Computer Networks

3 star(s)

This means that the message can come out of order it can also be corrupted or sections missing from the message without you knowing or noticing. UDP works at the transport layer. This protocol is as important as other protocols because the upper layer protocol has no guarantee from UDP that the message has been successfully delivery.

1. ## Visual basic

execute specific lines of code and to view the state of variables: o Step Into executes the next line o Step Over executes the next line but skips procedures o Step Out completes the current procedure * The debugging windows are used to view and change the state of variables: o Immediate windows (frequently used with debug.print)

2. ## Explain sequence, selection and iteration as used in computer programming; outline the benefits of ...

If we want to be able to use minus numbers, we also have to be aware that bytes will not be able to support these. (Mark Fishpool, 2011) In this comparison, bytes are less useful, but also happen to be two to four times as efficient when it comes to the amount of reserved space it creates in memory.

1. ## What is Visual Programming

NumericalUpDown * PictureBox * ProgressBar * Radiobutton * RichTextBox * Textbox * ToolTip * TreeView * WebBrowser * Flow LayoutPanel * Groupbox * Panel * Splitcontainer * Tabcontrol * Tablelayoutpanel * Contextmenustrip * Menustrip * Statusstrip * Toolstrip I obtained the functions for these programming languages from the following interfaces

2. ## Program Code Program DVD_Program; Uses Menuunit, CRT, dos; ...

Begin l:= length (number2); valid:= 0; FOR j:= 1 to 1 DO Begin If not (number2[j] in['1','2','3','4','5','6','7','8','9','0']) then valid:= j; Else stock:= 1 End; validatestock_number:= valid; if ( valid<> 0) then Begin textcolor(red); gotoxy(12,19); Write( 'SORRY INVALID NUMBER '); delay(800); gotoxy(12,19); Write (' '); textcolor(blue); gotoxy(37,15); For j:= 1 to

1. ## Investigating Visual Programs

Standard Debugging Techniques Standard Debugging Techniques include: * Using print statements to view the progress of a program the errors Commenting out sections of the code to isolate VB Debugger * Break Points can be used to halt execution at specific points * The debug mode can be used to

2. ## CP3 - Proposed Solution to a Realistic Problem - Apartment Administration software

There is also noway of tailoring the program to the users needs so there will be unnecessary features and the GUI is crowded with items that are not relevant. Programming Another way to create the system would be to code a program myself and therefore it can be tailored to the users needs.

• Over 160,000 pieces
of student written work
• Annotated by
experienced teachers
• Ideas and feedback to