18. CPU, RAM, HardDisk
• Computer Components
– https://www.youtube.com/watch?v=rK3YxmkarIg
– In this section you learn a little about the architecture
of a computer and some general terms to use when
talking about computer programs. This includes:
• CPU - Central Processing Unit
• RAM - Random Access Memory
• Hard Drive - A Persistent Storage Device
18
21. 補充 01
• What is a Computer?
• What is a Programming Language?
• Hello, world !
– 大多數程式語言的第一支程式
21
22. What is a Computer?
• A Computer (電腦,計算機) is composed of
– Central Processing Unit (CPU), (中央處理器)
– Random Access Memory (RAM), (隨機存取 記憶體)
– Input/Output (I/O) devices. (輸入輸出設備)
• A screen (螢幕) is an output device.
• A mouse (滑鼠) and a keyboard (鍵盤) are input devices.
• A hard drive (硬碟) is an I/O device.
keyboard
22
24. Hello, world !
大多數程式語言的第一支程式
#include <stdio.h>
main() {
printf("hello, world");
}
public class HelloWorld {
public static void main(String [] args) {
System.out.println("Hello world!");
}
}
print(‘Hello, world!’)
PRINT "Hello, world!"
BASIC
C
Python 3
Scratch
Java
印= print
印 (‘Hello, world !’)
24
JavaScript
alert('Hello, world!');
Scratch 中文化
Python 3 中文化
C++
#include <iostream>
int main() {
std::cout << "Hello, world!" << std::endl;
return 0;
}
25. • Assembly language — x86 Windows
; This program displays "Hello, World!" in a windows
messagebox and then quits.
;
; Written by Stewart Moss - May 2006
;
; Assemble using TASM 5.0 and TLINK32
;
; The output EXE is standard 4096 bytes long.
; It is possible to produce really small windows PE
exe files, but that
; is outside of the scope of this demo.
.486p
.model flat,STDCALL
include win32.inc
extrn MessageBoxA:PROC
extrn ExitProcess:PROC
.data
HelloWorld db "Hello, world!",0
msgTitle db "Hello world program",0
.code
Start:
push MB_ICONQUESTION + MB_APPLMODAL +
MB_OK
push offset msgTitle
push offset HelloWorld
push 0
call MessageBoxA
push 0
call ExitProcess
ends
end Start
25
蠻可怕的吧!
怪不得嚇跑一堆人。
26. 補充 02
• A hands-on introduction to Python for beginning
programmers
• http://www.pyvideo.org/video/1850/a-hands-on-
introduction-to-python-for-beginning-p
• http://www.pyvideo.org/video/2559/hands-on-intro-to-
python-for-beginning-programmer
• Introduction to Python with Jessica McKellar
• https://www.youtube.com/watch?v=sAU2l5MKCbI
• http://vplayer.oreilly.com/?chapter=http%3A%2F%2Fatom.o
reilly.com%2Fatom%2Foreilly%2Fvideos%2F2005177&video
_product=urn%3Ax-
domain%3Aoreilly.com%3Aproduct%3A9781491902141.VID
EO#embedded_player
26