⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 01.txt

📁 一個計算機系教授的上課講義 主要是教導學生使用C語言編寫程序
💻 TXT
字号:
CS 1355
Intro to Programming in C
Monday 2006.9.11 (Week 1)
Lecture Notes (at http://r638-2.cs.nthu.edu.tw/C/notes/01.txt)

Outline
- Welcome
- Computer
- Tools, Compilation
- Unix commands, VI
- Apply for your account

Welcome
- This class will be taught in English
- You are encouraged to ask questions in English (don't be afraid)
  Why? you will need English for later classes, too!
  All the latest technology news is written in English
- Course website: (for now)
  http://r638-2.cs.nthu.edu.tw/C/
  (we might make an easier name for it later!)

Overview
- Computer: machine that "computes"     (noun = "computation")
- Calculator: machine that "calculates" (noun = "calculation")
- what's the difference?
  - calculate (璸衡): add, subtract, multiply, divide numbers...
  - compute (簍衡): 
    * step-by-step
    * includes calculation
    * not just math, but also text
    * more generally, "data": includes image, sound, video, ...
- Program:
  - a description of computation
  - "understandable" by a computer

What does a computer manipulate (read, write, transform)?
- "bit" = binary digit = { 0, 1 }
  - too simple (2 possible values)... not very useful
- "byte" = eight bits as one unit
  - { 00000000, 00000001, 00000010, 00000011, 00000100, ... }
  - total of 2^8 = 256 possible values
    * can encode 0..255 (or any 256 distinct items)
    * can encode "characters"
      'A' = 65, 'B' = 66, 'C' = 67, 'a' = 97, 'b' = 98, 
      '1' = 49, '2' = 50, ...
- "word" = usually 4 bytes as one unit
- "string" = sequence of bytes
   can be of length 0, 1, 2, ... any non-negative length

Instruction
- A string that defines a step in computation
- Types of instructions
  - input and output (I/O)
  - memory read/write
  - "arithmetic" operation (+ - * / ...)
  - "logical" operation (and, or, not, xor, ...)
  - "control" (jump to another step, loop, ...)

Machine Language
- set of strings that a machine can "execute" (take action)
- Low level: "machine language"
  example (fake): 
    000 00010 = "load" (read) from memory location 2
    001 00111 = "add" data at memory location 7 to the current sum
    010 01000 = "store" (write) current sum to memory location 8
- Very hard to write program this way!

Assembly language
- use human-readable characters instead of writing 0 and 1
  example
     LOAD    BASEPAY
     ADD     OVERPAY
     STORE   GROPSSPAY
  First part represents the "opcode" (what "action" to take)
  Second part represents the "operand" (what "parameter")
- Normally 1-to-1 mapping between assembly and machine instruction
- Still low level, but a little easier for humans to read.
- Assembler:
  a program that translates an assembly language program into 0's and 1's
  (binary program)

Translation
- input: one language, output: another language
- Two types of translation
  * "compilation": (絪亩) translate the entire program first,
                      and then run the translated program.
  * "interpretation": (

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -