正在加载图片...
while Loop pitfall -3 r Goal: Execute the loop body 10 times ① count 1 (2 count 1 while( count 10) while( count <= 10) count++ count++i 3 count o 4 count=o while( count < 10 while( count 10) count++i coun七++; 1 and (3) exhibit off-by-one error C 2000 McGraw-Hill troduction to Object-Oriented Programming with Java--Wu Chapter 7-10© 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 7 - 10 while Loop Pitfall - 3 Goal: Execute the loop body 10 times. count = 1; while ( count < 10 ) { . . . count++; } 1 count = 0; while ( count <= 10 ) { . . . count++; } 3 count = 1; while ( count <= 10 ) { . . . count++; } 2 count = 0; while ( count < 10 ) { . . . count++; } 4 1 and 3 exhibit off-by-one error
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有