• Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

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

See related essaysSee related essays

Related AS and A Level Computer Science essays

  1. Marked by a teacher

    LAN & Topologies & Data Flow

    3 star(s)

    Any normal server can be transformed into a file server. Indeed a file server is mostly used in a private LAN network, which is probably password protected so user's from outside the network cannot hack it. Ethernet cables are normally used to connect servers to a network.

  2. 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)

  1. 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.

  2. ICT Sample Work Welcome Centre Requirements

    "Full Day" Look-up and display Capacity and Unit Room Cost for each room required for the booking Show Capacity: Lookup and show the Max. Capacity from the Rooms Table Show Unit Room Cost: Lookup and show the Commercial Rate for the room from the Rooms Table, depending on the Event Type (1/2 Day or Full Day price)

  1. Free essay

    What is Visual Programming

    * Visual studio 2005 * Net Beans There are many properties that the languages posses, for example, text boxes, frames, buttons, lists, scroll bars. The only difference is that they have differing names, although not dramatically. The java swing package implements a "J" before the term, jtextbox, jbutton, jpane and so on.

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

    Add_Menu ('Add a video record', 1, 5); Add_Menu ('-', 1, 6); Add_Menu ('Locate member record', 1, 7); Add_Menu ('Locate video record', 1, 8); Add_Menu ('-', 1, 9); Add_Menu('View all member records', 1, 10); Add_Menu('View all video records', 1, 11); Add_Menu ('Edit', 2, 1); Add_Menu ('Edit a member record', 2, 2);

  1. Investigating Visual Programs

    * The most common text operator is "&", the concatenation of strings. * Each text character has an associated code. * Numeric operators include "+" addition, "-" subtraction, "*" multiplication, "/"division, and "\" integer division. * Operators have a specific order of precedence.

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

    Delphi requires minimal amount of coding and is very fast to produce programs with. Delphi is my preferred choice as I do not have much experience in coding and it has a good compiler with the addition of being able to make good looking interfaces.

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