Inverse hyperbolic cosine acosh( x ) Returns an angle in degrees corresponding to the hyperbolic cosine value x ... it is equivalent to mod( x,1 ) )[r]
Trang 1ỨNG DỤNG CROCODILE
TRONG GIẢNG DẠY TIN HỌC
Trang 21 GIỚI THIỆU CROCODILE ICT
• Crocodile ICT (Crocodile I nformation and
C ommunication T echnologies) là phần mềm do Crocodile Clips Ltd sản xuất vào năm 1993-2005, với phiên bản đầu tiên là Crocodile ICT 410 (501,
504, 509 vào 605).
• Hiện tại Crocodile ICT đã được tích hợp chung với các phiên bản khác và đổi tên thành Yenka.
Trang 32 GIỚI THIỆU CÁC CÔNG CỤ TRONG CROCODILE ICT 605
Start Bắt đầu của một chương trình Begin
On buttom press Khi nút liên kết được ấn
On event Khi sự kiện được tác động
On receive Khi nhận được “lệnh”
Repeat every Lệnh được lặp sau 1 khoảng thời gian Stop Kết thúc của một chương trình End Funtion Bắt đầu của một chương trình con Funcion Return Kết thúc của một chương trình con End
Chương trình con trong Crocodile ICT rất giống trong ngôn ngữ C/C++, chỉ khác là trị trả về (nếu có) không cần khai báo trước và kiểu trả về cũng được linh hoạt (tùy trường hợp, có thể trả về các kiểu khác nhau)
Trang 4Nút Ý nghĩa Lệnh pascal
Set variable Gán giá trị cho 1 đối tượng :=
Increment variable Tăng 1 đơn vị cho biến Inc
Random Tạo 1 số ngẫu nhiên trong [0 1] Random Delay Tạo 1 khoảng dừng khi chạy Delay
Send Tạo một “lệnh”
Receive Nhận một “lệnh”
Call function Gọi một hàm thi hành
Trang 5Nút Ý nghĩa Lệnh pascal
Test Tạo một rẽ nhánh If
Trang 6Nút Ý nghĩa Lệnh pascal
Call action Gọi một hành động ( chỉ có những đối
tượng minh họa mới có) Get property Nhận “thuộc tính”: thường dung để nhận
giá trị hoặc các thuộc tính của đối tượng liên kết
Set property Gán giá trị/ thuộc tính cho một đối tượng
liên kết Sound Thực hiện 1 đoạn âm thanh, có thể là 1 file
Trang 7Nút Ý nghĩa Lệnh pascal
Monitor box Dùng để theo dõi sự thay đổi của các trị
trong lưu đồ Scene (gobal)
variable
Theo dõi trị của các biến toàn cục trong lưu đồ
Trang 8Thường dung liên kết với Get Property / Set Property
Trang 9Các hàm trong Crocodile ICT
sqrt(x) căn bậc II của X
fact(x) X!
pow(x,y) X Y
mod(x,y) phần dư của phép chia x cho y floor(x) lấy phần nguyên của x
round(x) Làm tròn LÊN của x
ln(x) Log cơ số e của x
Lưu ý hàm phân biệt chữ hoa với chữ thường
Trang 10Name Syntax Description
Sine sin(x) Returns the sine value of an angle x (in degrees).
Cosine cos(x) Returns the cosine value of an angle x (in degrees).
Tangent tan(x) Returns the tangent value of an angle x (in degrees).
Inverse sine asin(x) Returns an angle between -90° and 90° corresponding to the sine value x.
Inverse cosine acos(x) Returns an angle between 0° and 180° corresponding to the cosine value x.
Inverse tangent atan(x) Returns an angle between -90° and 90° corresponding to the tangent value x.
Secant sec(x) Returns the secant value of an angle x (in degrees).
Cotangent cot(x) Returns the cotangent value of an angle x (in degrees).
Cosecant csc(x) Returns the cosecant value of an angle x (in degrees).
Inverse secant asec(x) Returns an angle in degrees corresponding to the secant value x.
Inverse cotangent acot(x) Returns an angle in degrees corresponding to the cotangent value x.
Inverse cosecant acsc(x) Returns an angle in degrees corresponding to the cosecant value x.
Hyperbolic tangent tanh(x) Returns the hyperbolic tangent value of an angle x (in degrees).
Hyperbolic sine sinh(x) Returns the hyperbolic sine value of an angle x (in degrees).
Hyperbolic cosine cosh(x) Returns the hyperbolic cosine value of an angle x (in degrees).
Inverse hyperbolic tangent atanh(x) Returns an angle in degrees corresponding to the hyperbolic tangent value x.
Inverse hyperbolic sine asinh(x) Returns an angle in degrees corresponding to the hyperbolic sine value x.
Inverse hyperbolic cosine acosh(x) Returns an angle in degrees corresponding to the hyperbolic cosine value x.
Trang 11Name Syntax Description
Square root sqrt(x) Returns the positive square root of x
Factorial fact(x) Returns the value of x * (x-1)*(x-2)*…*1
Raise to power pow(x,y) Raises x to the power of y (xy)
Modulo mod(a,b) Divides a by b and returns the remainder
Random rand() Returns a random (decimal) number in the range 0 - 1
Exponent exp(x) Raises e to the power of x
Absolute value abs(x) Returns the absolute value of x
Floor value floor(x) Returns the value of x rounded down to the nearest integer
Ceiling value ceil(x) Returns the value of x rounded up to the nearest integer
Round round(x) Rounds x to the nearest integer and returns the integer
Fractional value frac(x) Returns the fractional part of x (i.e it is equivalent to mod(x,1) )
Logarithm log(x) Returns the log (to base 10) of x
Natural Logarithm ln(x) Returns the log to base e of x
Bit bit(x,y) Returns the Boolean value of the yth bit of the binary form of x
Size size(x) Returns the number of values in a list
Trang 123 ỨNG DỤNG VÀO VẼ LƯU ĐỒ (SƠ ĐỒ KHỐI) GIẢI MỘT SỐ BÀI TOÁN
1 Giải phương trình ax + b = 0.
2 Giải phương trình bậc II: ax 2 + bx + c = 0
3 Nhập vào n số a 1 , a 2 , …,a n Xuất ra số có giá trị lớn nhất
4 Nhập vào n số a 1 , a 2 , …,a n Xuất ra Số lượng số nguyên tố (có sử dụng chương trình con)
Trang 13Sơ đồ khối phương trình ax + b = 0
- Sơ đồ khối theo sách giáo khoa
- Khi chạy chương trình để kiểm tra, tốn nhiều công sức để giải thích giá trị của từng biến ở mỗi bước.
- Ở mỗi chỗ rẽ nhánh của chương trình cần được đánh dấu cho học sinh thấy
BĐ
a, b = ?
a = 0
b = 0
x = -b/a
Xuất x
KT
S
Đ
Đ S
Trang 14CẢM ƠN QUÝ THẦY CÔ