一個計算機系教授的上課講義 主要是教導學生使用C語言編寫程序

源代码在线查看: 11.txt

软件大小: 93 K
上传用户: zhangchao0219
关键词: 程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				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" (			

相关资源