罗国明 钟晴江
摘要: 程序设计是一门逻辑性很强的课程,教会学生编程关键是教会学生编程的思想,以及分析、解决问题的方法。很多程序的编程思想都有类似之处。文章利用归纳法的思想,把进制转换归纳成具有共性的问题进行归类,设计了把2、8、16进制统一转换为10进制的算法;同样设计了把10进制转换为2、8、16进制的统一算法。把这种归纳法的思想应用于教学,取得了良好的教学效果。
关键词: 程序设计; 归类; 进制转换
中图分类号:TP3-05文献标志码:A文章编号:1006-8228(2012)05-45-02
Digital conversion algorithm research based on classified teaching
Luo Guoming, Zhong Qingjiang
(Zhejiang University, Information Management Department of City College, Hangzhou, Zhejiang 310015, China)
Abstract: "Programming" is a strong logical course. how to teach students programming? The key is to teach students programming ideas, how to analyze problems and solve the problem. A lot of programming methods are similar. Using inductive method, with common problems grouped into a classified, the algorithm of transfering binary, octal, hexadecimal into decimal, decimal into a unified binary, octal, hexadecimal is developed, This same idea can be easily extended to other similar programming, and the idea of this inductive method used in teaching, has been a good teaching results obtained.
Key words: programming; classified; digital conversion
0 引言
程序设计是一门非计算机专业的公共基础课。随着对程序设计教学手段和教学方法研究和探讨的不断深入,我们的教学方法也在不断地推进,并从平时的教学实践中总结出很多适应现代大学生的教学方法和手段。程序设计课程除了要教会学生如何思考问题、分析问题、解决问题,还必须教会学生一些程序设计的关键算法,教会学生能从问题中分析并提取关键因素,然后把具有共同特性的一类问题归结为一个算法。本文以进制转换的算法为例,从教学的角度探讨了进制转换算法的归类实现思想[1]。由于篇幅关系,我们只讨论整数部分的进制转换。
1 把2、8、16进制转化为10进制的统一算法
我们用进位计数制来说明2、8、16进制转化为10进制的方法。
进位计数制是人们利用符号来计数的一种方法。进位计数制使用了一组数码符号、基数和位权[2]。
⑴ 数码:用不同的数字符号来表示一种数制的数值,这些数字符号称为“数码”。……