Tarea 123

Páginas: 8 (1922 palabras) Publicado: 4 de marzo de 2011
D. Introduction to Programming with RAPTOR

By Lt Col Tom Schorsch

The RAPTOR Programming Language

RAPTOR is a visual programming language based on flowcharts. Flowcharts were developed as a design aid for developing programs; however, with RAPTOR they are a programming language in their own right as the flowcharts you develop can be executed by the RAPTOR development environment.

Weuse RAPTOR in CS110 for several reasons. First, the RAPTOR language has minimal syntax (grammar) when compared with other programming languages. This makes Raptor programs easy to write as there are fewer language elements that you have to learn to be productive. Second the RAPTOR language is visual; RAPTOR programs are diagrams (directed graphs). One of the hardest aspects of programming tounderstand and get right is the flow of control of the statements in your program. The visual nature of the flow of control in RAPTOR programs makes them easier to understand and program. Third, we developed the programming language and development environment. We sought to make the development environment easy to use and the error messages that RAPTOR displays to you easy to understand. We areconstantly trying to improve RAPTOR, so if you have suggestions please tell us. Fourth, our purpose is not to teach you how to program in particular language. We want to teach you how to design and execute algorithms to solve problems, and to implement algorithms using computer-based problem solving tools. These objectives do not require a heavy-weight commercial programming language such asC++ or Java.

What will you be missing by using RAPTOR instead of some other more conventional programming language? First, you will miss using a complex development environment that has been designed to be useful to professional software developers but is extremely difficult to use in an educational environment by novice programmers. Second, you will miss programming in a large complexprogramming language with complex syntax and semantics. Third, you will not see cryptic error messages describing the multitude of syntax errors you might commit while programming in the complex programming language using the complex programming environment.

RAPTOR Program Structure

A RAPTOR program is a directed graph. When executing a program, you begin at the Start symbol at the top and followthe arrows to execute the program. Raptor programs end with the End symbol. The smallest RAPTOR program (which does nothing) is depicted at the right. By placing additional RAPTOR statements between the Start and End symbols you create more meaningful RAPTOR programs.

RAPTOR Variables

Variables are memory locations that hold a value. At any given time a variable can only hold a singlevalue of a particular type of data, however, as the program executes, the data value stored in the variable can change. They are called variables because the data stored by them can vary as the program executes.

As an example, the RAPTOR statement X←32 assigns the data value 32 to the variable X. If that statement is followed by the statement X←X+1 the value of 32 is retrieved from X, thevalue 1 is added to it, and the result (33) is stored back in variable X replacing the value that was previously stored there. Thus, in the program at the right, the variable X initially had no value, then it is assigned the value 32, then it is assigned the value 33, and finally it is assigned the value 66. If you are reading this on-line (and have RAPTOR installed) you can execute the program bydouble-clicking here: Variable value changing over time Example.rap. You can step through the program and see the value of variable X change by clicking on the [pic] button.

A variable is normally used to hold a value that is not known before the program starts running. This value could be read in from the user, or it could be computed from other values, and so the exact value that is stored...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • la tarea del 123
  • Tarea 123
  • TAREA ENIL 123 2
  • Tarea 123
  • Tarea pro 123
  • tarea de informatica preguntas 123
  • Mariel Tarea Fisica 123
  • 123

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS