Raptor Mr. Lau Ka Lun Lai King Catholic Secondary School.

Slides:



Advertisements
Similar presentations
RAPTOR Syntax and Semantics By Lt Col Schorsch
Advertisements

Return values.
Copyright © 2012 Pearson Education, Inc. Chapter 3: Expressions and Interactivity.
1 Fundamental Data types Overview l Primitive Data Types l Variable declaration l Arithmetical Operations l Expressions l Assignment statement l Increment.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 3: Expressions and Interactivity.
Introduction to Matlab. Entering Commands Constants and Functions >> pi ans = >> eps ans = e-016 >> sin(pi/2) ans = 1 >> log(1000) ans =
1 Data types, operations, and expressions Continued l Overview l Assignment statement l Increment and Decrement operators l Short hand operators l The.
CHAPTER 3: CORE PROGRAMMING ELEMENTS Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
Microsoft® Small Basic The Math Object Estimated time to complete this lesson: 1 hour.
Chapter 4: Looping CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp.
INTRODUCTION TO PYTHON PART 1 CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
Fundamentals of Python: From First Programs Through Data Structures
Computer Science 1000 Spreadsheets II Permission to redistribute these slides is strictly prohibited without permission.
Expressions and Interactivity Chapter 3. 2 The cin Object Standard input object Like cout, requires iostream file Used to read input from keyboard Often.
19/5/2015CS150 Introduction to Computer Science 1 Announcements  1st Assignment due next Monday, Sep 15, 2003  1st Exam next Friday, Sep 19, 2003  1st.
EG280 - CS for Engineers Chapter 2, Introduction to C Part I Topics: Program structure Constants and variables Assignment Statements Standard input and.
4. Python - Basic Operators
Fundamentals of Python: First Programs
Outlines Chapter 3 –Chapter 3 – Loops & Revision –Loops while do … while – revision 1.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
Chapter 2 - Algorithms and Design
CSE1222: Lecture 4The Ohio State University1. Mathematical Functions (1)  The math library file cmath Yes, this is a file with definitions for common.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
CNG 140 C Programming Lecture Notes 2 Processing and Interactive Input Spring 2007.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
Input, Output, and Processing
CSE 102 Introduction to Computer Engineering What is an Algorithm?
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
1 Math Expressions and Operators. 2 Some C++ Operators Precedence OperatorDescription Higher ( )Function call +Positive - Negative *Multiplication / Division.
Math With Java The Math Class. First, A Quick Review of Math Operators in Java Primitive Data type in Java that represent numbers: Primitive Data type.
Introduction to Programming with RAPTOR
Visual Basic Programming
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
1 Chapter 2 - Algorithms and Design print Statement input Statement and Variables Assignment Statement if Statement Flowcharts Flow of Control Looping.
Basic Control Structures
Operators Precedence - Operators with the highest precedence will be executed first. Page 54 of the book and Appendix B list C's operator precedence. Parenthesis.
Exam 1 Review Instructor – Gokcen Cilingir Cpt S 111, Sections 6-7 (Sept 19, 2011) Washington State University.
Sin, Cos, Tan with a calculator  If you are finding the sin, cos, tan of an angle that is not a special case (30, 60, 45) you can use your calculator.
Expressions and Interactivity. 3.1 The cin Object.
Program Development C# Programming January 30, 2007 Professor J. Sciame.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
1 CS1371 Introduction to Computing for Engineers Control Statements 9/4/2003.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
Python Mini-Course University of Oklahoma Department of Psychology Day 3 – Lesson 10 Iteration: Loops 05/02/09 Python Mini-Course: Day 3 - Lesson 10 1.
29 January 2016Birkbeck College, U. London1 Introduction to Programming Lecturer: Steve Maybank Department of Computer Science and Information Systems.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
CS 115 Lecture 5 Math library; building a project Taken from notes by Dr. Neil Moore.
Chapter INTRODUCTION Data Types and Arithmetic Calculations.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Third Edition by Tony Gaddis.
Lecture 3 Expressions, Type Conversion, Math and String
Introduction to Computer Programming
Topics Designing a Program Input, Processing, and Output
Chapter 2 Assignment and Interactive Input
Algorithms and Flowcharts
Introduction to Programming
Formatted and Unformatted Input/Output Functions
RAPTOR Syntax and Semantics By Lt Col Schorsch
Expressions and Interactivity
Introduction to C++ Programming
Introduction to MATLAB
Introduction to Programming Using Python PART 2
Topics Designing a Program Input, Processing, and Output
Introduction to Programming with Python
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
COMPUTING.
Introduction to Python
Presentation transcript:

Raptor Mr. Lau Ka Lun Lai King Catholic Secondary School

Introduction RAPTOR is freely distributed as a service to the CS education community. It was originally developed by and for the US Air Force Academy, Department of Computer Science. It is free software. RAPTOR is a flowchart-based programming environment. to help students visualize their algorithms and avoid syntactic baggage. RAPTOR programs are created visually and executed visually by tracing the execution through the flowchart. Required syntax is kept to a minimum.

Website

Layout Mode -> Novice Run the program Pause Stop Speed of running Generate source code

Program Structure When executing a RAPTOR program, you begin at the Start symbol and follow the arrows to execute the program A RAPTOR program stops executing when the End symbol is reached.

RAPTOR Statements/Symbols The top four statement types: – Assignment, Call, Input, and Output The bottom two types: – Selection and Loops

RAPTOR Variables DescriptionValue of X  When the program begins, no variables exist. In RAPTOR, variables are automatically created when they are first used in a statement. Undefined  The first assignment statement, X←32, assigns the data value 32 to the variable X. 32  The next assignment statement, X←X+1, retrieves the current value of X, 32, adds 1 to it, and puts the result, 33, in the variable X. 33  The next assignment statement, X←X*2, retrieves the current value of X, 33, multiplies it by 2, and puts the result, 66, in the variable X. 66 Program

Common errors when using variables

Input Statement/Symbol

Assignment Statement/Symbol Variable ← Expression

Operators and Functions OperationDescriptionExample + addition 3+4 is 7 - subtraction 3-4 is -1 - negation -3 is a negative 3 * multiplication 3*4 is 12 / division 3/4 is 0.75 ^ ** exponentiation, raise a number to a power 3^4 is 3*3*3*3=81 3**4 is 81 rem mod remainder (what is left over) when the right operand divides the left operand 10 rem 3 is 1 10 mod 4 is 2 sqrt square root sqrt(4) is 2 log natural logarithm (base e) log(e) is 1 abs absolute value abs(-9) is 9 ceiling rounds up to a whole number ceiling( ) is 4 floor rounds down to a whole number floor(9.82) is 9 sin trig sin(angle_in_radians) sin(pi/6) is 0.5 cos trig cos(angle_in_radians) cos(pi/3) is 0.5 tan trig tan(angle_in_radians) tan(pi/4) is 1.0 cot trig cotangent(angle_in_radians) cot(pi/4) is 1 arcsin trig sin -1 (expression), returns radians arcsin(0.5) is pi/6 arcos trig cos -1 (expression), returns radians arccos(0.5) is pi/3 arctan trig tan -1 (y,x), returns radians arctan(10,3) is arccot trig cot -1 (x,y), returns radians arccot(10,3) is random generates a random value in the range [1.0, 0.0) random * 100 is some value between 0 and Length_of returns the number of characters in a string variable Example ← "Sell now" Length_of(Example) is 8

Procedure Call Statement/Symbol

Examples

Examples (cont.) Read_Scores Calculate_Average_ScorePrint_Those_Above_Average

Output Statement/Symbol

Comments in RAPTOR

Sequential Program Control in sequence one-after-the-other

Selection Control

relational and logical operators OperationDescriptionExample = "is equal to" 3 = 4 is No(false) != /= "is not equal to" 3 != 4 is Yes(true) 3 /= 4 is Yes(true) < "is less than" 3 < 4 is Yes(true) <= "is less than or equal to" 3 <= 4 is Yes(true) > "is greater than" 3 > 4 is No(false) >= "is greater than or equal to" 3 >= 4 is No(false) andYes(true) if both are Yes(3 < 4) and (10 < 20) is Yes(true) orYes(true) if either are Yes(3 20) is Yes(true) xorYes(true) if the "yes/no" values are not equal Yes xor No is Yes(true) not Invert the logic of the value Yes if No ; No if Yes not (3 < 4) is No(false)

Selection Control Examples

Cascading Selection statements

Loop (Iteration) Control

Input Validation Loops

Counting Loops Statements to be repeated

Input Loops

"Running Total" Loops

"Counting" Loops

Exercises Write a series of RAPTOR statements that determines if X has the value 1, 2, or 3, and prints out “ONE”, “TWO”, or “THREE” accordingly. Write a complete program that converts between degrees Fahrenheit and Celsius. The user must first enter the conversion that is desired (F to C or C to F) using any means you want and then enter the value to be converted. The formulas for conversion are: F = 9/5 C + 32 and C = 5/9 (F – 32) Write a complete program that plays the game of HI-LO. The program asks one user for a number between 1 and 100 and verifies that such a number has been entered. It then asks a second user for a guess and reads it in. If the guess is correct a congratulation message is written to the screen and the program ends. Otherwise the message “HI” or “LOW” is displayed (if the guess is higher or lower) and another guess is asked for and read in.