11.txt
来自「一個計算機系教授的上課講義 主要是教導學生使用C語言編寫程序」· 文本 代码 · 共 24 行
TXT
24 行
CS 1355
Introduction to Programming in C
Monday 2006.10.16 (Week 6)
Lecture notes (at http://r638-2.cs.nthu.edu.tw/C/notes/11.txt)
Chapter 5 continued (pp.161-169)
- Book example: Game of Chance
- Enumerated data type
- Storage Classes (auto, register, extern, static)
- Scoping rules
Rule: Game of Chance
- roll two dice (each is 1, 2, 3, 4, 5, 6)
- on first throw:
if sum is 7 or 11 => player wins
if sum is 2, 3, 12 => player loses
if sum is 4,5,6,8,9,10 => sum becomes point, throw again.
- on subsequent throw:
if sum is 7 => player loses
if sum is point => player wins
all other sum => throw again.
How to solve this problem?
1. concept of "state" or "status" (
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?