add range checking for safety.
	modified:   ex2_4_1a.cpp        safe
	modified:   ex2_4_1c.cpp        not safe, need refactor
	ex2_4_1b.cpp