raptor - hong kong education city -...

27
Raptor Thomson Chan Rosaryhill School [email protected] 36983585

Upload: lamanh

Post on 02-May-2018

225 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Raptor

Thomson Chan

Rosaryhill School

[email protected]

36983585

Page 2: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Depository of Curriculum-based

Learning and Teaching resources

• http://www.hkedcity.net/edb/teachingresources

Page 3: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Depository of Curriculum-based

Learning and Teaching resources

• Online learning & teaching tools

Page 4: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Depository of Curriculum-based

Learning and Teaching resources

• ICT – Programming - Raptor & C • Raptor Flowchart Programming Note and Exercise (S3)

Page 5: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Depository of Curriculum-based

Learning and Teaching resources

• ICT – Programming - Raptor & C

• Raptor Flowchart Programming (with C)

Page 6: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Introduction to Raptor

• A flowchart-based programming environment.

• Help student visualize their algorithms.

• Create visually and executed visually

• Free and not hardware demanding.

• Only need to learn a small amount of syntax.

• Can generate exe file and real code.

Page 7: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Programming Curriculum in RHS

• Taster of programming in S3, up to

selection.

• S4 ICT Programming in Core only.

• Raptor + AppInventor / Scratch

• Online compiler

http://www.compileonline.com/

Page 8: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

CDI - curriculum

• No flowchart symbols provided in

curriculum documents. Drawing Flowchart

is needed.

• Pseudo code and Program Flowchart.

Translation between flowchart and Pseudo

code.

• Simple data types (Raptor: not strong

typing) and 1-D array.

Page 9: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

CDI - curriculum

• Basic Control structure. (Raptor: No Multi-

way selection and for loop)

• Sub-problems or modules: Use sub-chart

in Raptor.

• Dry Run: Trace and test algorithms.

Page 10: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Installation

• http://raptor.martincarlisle.com

(raptor_2012.msi)

• Portable version is available

(RaptorPortable_4.0_Revision_6.paf.exe)

• More on portable apps

http://portableapps.com

Page 11: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Software environment

Page 12: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Variables

• Name of variable

– A name must begin with a letter

– Combinations of letters, digits, or underscores

– Spaces are not allowed in a name

– Names are NOT case sensitive

– Use meaningful name

• Initialize the variable.

Page 13: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Data types

• Not strongly typed.

• Basic Data types: Numbers (real, integer),

strings

• Array

• Index must be positive integer (1,2,3,..)

• No need to declare the size of array.

Page 14: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Symbol Window (Statement)

• Six symbols

– Assignment

– Input

– Output

– Call

– Selection

– Loop (Support Pretest

and Posttest)

Page 15: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Ex1: Input and output statement

• “ “ string constant

• + Concatenation

Page 16: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Assignment statement

• Set <variable> to <Expression>

• Relational Operator and Logical

operator can not be used in

<Expression>

Arithmetic

operator

+ , - , * , /

^, ** (exponentiation)

Maths

functions

rem, mod (remainder)

sqrt, log, abs, sin, cos, tan

Relational

operator

= , < , > , <= , >= ,

!= , /= (not equal)

Logical

operator

AND, OR, NOT

Page 17: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Ex2:Sequence

Input Process Output

R Area3.1416*R^2 Area

H, W BMIW/(H*H) BMI

Page 18: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Selection (if..then..else)

• Ex 2b

BMI value Output

Below 18 Underweight

18 - 24 Normal

Above 24 Overweight

Page 19: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Iteration (pre-test / Post-test /For)

Pre-test Post-test For loop

execute (0..N) at least once. (1..N) No of times known.

While <condition> do

<Loop body>

(Raptor)

Repeat <loop body>

Until <condition>

Or

Do <loop body>

While <condition>

For count=M to N do

<loop body>

Page 20: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Ex 3a: Pretest (while .. Do)

Page 21: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Ex 3b: Post-test (Repeat..until)

• Validation

• 0 mark 100

• Amend the condition

when writing pseudo

code using do..while.

Page 22: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Avoid using unstructured loop

• Either use Post-test

statement or pretest

statement.

Page 23: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Iteration (Simulate For Loop)

• Calculate 1+2+..N

• In C++

cin>>N;

int sum=1;

for (int i=1; i<=N; i++)

{sum=sum+i;}

cout<<sum;

• Prefer to use Scratch or

other tools.

Page 24: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Sub-chart / Procedure

- Build in procedure support variable

passing.

- Novice mode (create sub-chart)

- Variable are shared (All are Global)

- Do not support passing of parameters.

- Intermediate mode (create procedure)

- support parameter passing and recursion.

- Demo Video

Page 25: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Other features

• Adding Comments

• Run step by step (F10 or icon )

• Toggle breakpoint.

• Generate executable (exe file)

• Menu – Ink (Draw / Erase)

• Drawing by calling build in procedure.

Page 26: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Generate Source code (Ada, C#, Java,

C++)

• C++ are case sensitive.

• Change all variable into small letter. (i, sum)

• Add “output sum” at the end.

• Generate C++ for ex3a.rap

• Add data type (int) for i and sum

• Copy and paste to the URL http://www.compileonline.com/compile_cpp_online.php

• Demon Video

Page 27: Raptor - Hong Kong Education City - Redirecting...edblog.hkedcity.net/.../6219/uploads/raptor/raptor2.pdf ·  · 2013-01-22• ICT – Programming - Raptor & C • Raptor Flowchart

Viewing student’s work

• Students are required to submit *.rap

• HELP : Show Log, Count Symbols

• Command Extract_times_all in Master

Console.

• Demon video