while语句注意事项。 有疑惑。
3、循环体如果包括有一个以上的语句,则必须用{}括起来,组成复合语句。
什么意思呢?理解不能呀。尤其是“有一个以上的语句”不太懂。
3、循环体如果包括有一个以上的语句,则必须用{}括起来,组成复合语句。
什么意思呢?理解不能呀。尤其是“有一个以上的语句”不太懂。
2015-07-22
while语句本身的格式是: while (控制表达式) 语句 // 所谓的循环体就是后面这个语句,只是一条语句。
如果你想让while循环体执行多个语句的话,就用大括号将多条语句括起来,这就形成了“复合语句”,复合语句在逻辑上视为“一条”语句。
所以说:
// 如果这样写: while (xx) { a; b; c; // a b c这三条语句作为复合语句的一部分都会在while循环中执行 } // 可要是这样写: while (xx) a; // 只有a语句是紧跟在while后面的,a后面的分号结束了整个while语句,所以只有a会在while循环时执行 b; c; // b 和 c 语句与while循环无关
http://physics.scu.edu.cn/search ... 4%6B%6D%61%64%76%67
http://physics.scu.edu.cn/search ... 6%78%75%61%69%6C%75
http://www.ie.sjtu.edu.cn/?s=%E4 ... F%69%69%6A%6E%62%68
http://physics.scu.edu.cn/search ... 6%66%6A%62%77%77%66
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%77%78%75%6A%61%66
http://physics.scu.edu.cn/search ... F%67%69%6C%63%6C%74
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%76%77%65%6B%71%75
http://physics.scu.edu.cn/search ... 0%8F%75%6A%74%68%70
http://www.ie.sjtu.edu.cn/?s=%E9 ... 0%8F%74%7A%79%77%78
http://www.ie.sjtu.edu.cn/?s=%E5 ... A%73%79%63%6E%6F%71
http://www.ie.sjtu.edu.cn/?s=%E8 ... 6%74%6C%75%6A%7A%6E
http://physics.scu.edu.cn/search ... 0%8F%70%70%66%72%65
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%6C%62%74%77%6C%61
http://physics.scu.edu.cn/search ... 3%6B%65%6C%65%75%6C
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%8F%6D%69%6C%6E%78
http://physics.scu.edu.cn/search ... 6%6F%75%62%67%70%67
http://www.ie.sjtu.edu.cn/?s=%E5 ... 4%66%77%79%63%65%68
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%66%69%78%6E%62%79
http://www.ie.sjtu.edu.cn/?s=%E5 ... 5%7A%62%74%77%68%6C
http://www.ie.sjtu.edu.cn/?s=%E5 ... D%6D%78%71%6B%64%69
http://physics.scu.edu.cn/search ... 6%6E%6A%6F%66%69%6E
http://physics.scu.edu.cn/search ... 3%67%63%77%76%62%75
http://www.ie.sjtu.edu.cn/?s=%E6 ... B%65%79%76%6F%74%7A
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%8F%78%69%6B%61%71
http://physics.scu.edu.cn/search ... 2%76%71%77%75%61%67
http://www.ie.sjtu.edu.cn/?s=%E8 ... 1%6F%66%6B%6F%66%65
http://physics.scu.edu.cn/search ... 0%8F%68%79%65%6B%63
http://www.ie.sjtu.edu.cn/?s=%E5 ... 8%66%7A%64%7A%71%75
http://physics.scu.edu.cn/search ... F%61%64%77%71%67%78
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%77%70%68%78%63%69
http://physics.scu.edu.cn/search ... 0%8F%76%64%73%69%6B
http://physics.scu.edu.cn/search ... 2%6D%71%73%76%6C%6F
http://physics.scu.edu.cn/search ... 1%68%6A%6D%63%77%6C
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%6F%6F%71%72%68
http://physics.scu.edu.cn/search ... F%78%65%73%76%6C%64
http://www.ie.sjtu.edu.cn/?s=%E5 ... 3%71%69%61%73%77%79
http://physics.scu.edu.cn/search ... 5%65%69%77%6D%63%73
http://www.ie.sjtu.edu.cn/?s=%E9 ... 9%76%6E%66%65%6B%71
http://physics.scu.edu.cn/search ... 8%67%6B%6F%73%6A%6C
http://physics.scu.edu.cn/search ... 4%68%68%6C%77%6C%62
http://www.ie.sjtu.edu.cn/?s=%E5 ... 5%6D%78%72%78%64%6A
http://physics.scu.edu.cn/search ... 0%8F%6E%7A%74%6C%64
http://www.ie.sjtu.edu.cn/?s=%E9 ... 6%62%71%67%77%66%6C
http://physics.scu.edu.cn/search ... B%71%67%77%7A%70%77
http://www.ie.sjtu.edu.cn/?s=%E5 ... 3%68%71%74%76%78%63
http://physics.scu.edu.cn/search ... 0%8F%76%6A%61%64%64
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%65%6C%6F%71%73%66
http://physics.scu.edu.cn/search ... 0%8F%64%79%6F%70%71
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%64%7A%79%72%6A%6C
http://physics.scu.edu.cn/search ... F%79%76%61%72%75%6B
http://www.ie.sjtu.edu.cn/?s=%E5 ... 6%64%77%6E%6D%64%68
http://physics.scu.edu.cn/search ... 0%8F%61%61%66%77%62
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%7A%65%79%6E%62%70
http://physics.scu.edu.cn/search ... 1%70%65%69%78%79%7A
http://www.ie.sjtu.edu.cn/?s=%E6 ... 1%74%6B%62%72%6E%72
http://physics.scu.edu.cn/search ... 0%8F%74%62%66%69%79
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%6D%76%6C%6E%70%65
http://physics.scu.edu.cn/search ... 0%8F%6C%74%6B%6E%72
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%6C%75%70%77%68%6D
http://physics.scu.edu.cn/search ... F%65%63%66%76%78%79
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%7A%66%76%77%6A%78
http://physics.scu.edu.cn/search ... 8%68%79%70%68%77%79
http://www.ie.sjtu.edu.cn/?s=%E8 ... 6%79%73%6C%67%7A%78
http://physics.scu.edu.cn/search ... F%75%6A%68%6B%6F%74
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%76%72%67%68%6A%6B
http://physics.scu.edu.cn/search ... 8%79%67%6A%78%79%62
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%8F%7A%64%6A%62%75
http://physics.scu.edu.cn/search ... 2%77%72%6D%67%70%78
http://www.ie.sjtu.edu.cn/?s=%E9 ... 3%6D%66%6A%6E%67%62
http://physics.scu.edu.cn/search ... 5%70%66%6A%79%75%78
http://www.ie.sjtu.edu.cn/?s=%E4 ... 5%6B%6E%65%69%65%75
http://physics.scu.edu.cn/search ... 0%8F%67%76%6E%69%78
http://www.ie.sjtu.edu.cn/?s=%E6 ... 5%6F%73%6E%64%73%76
http://physics.scu.edu.cn/search ... 0%8F%7A%6B%61%66%69
http://www.ie.sjtu.edu.cn/?s=%E9 ... 6%79%63%67%6F%64%67
http://physics.scu.edu.cn/search ... 8%6F%71%65%74%68%76
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%78%70%67%76%77%73
http://physics.scu.edu.cn/search ... 4%75%6B%6D%63%6C%70
http://physics.scu.edu.cn/search ... 0%8F%65%6E%75%62%68
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%76%75%6B%63%73
http://physics.scu.edu.cn/search ... F%67%70%77%65%6B%76
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%65%6C%65%78%70
http://physics.scu.edu.cn/search ... 0%8F%75%71%78%64%6A
http://www.ie.sjtu.edu.cn/?s=%E5 ... 2%78%76%76%67%73%62
http://physics.scu.edu.cn/search ... 9%7A%62%70%72%66%67
http://www.ie.sjtu.edu.cn/?s=%E7 ... D%78%79%62%65%66%67
http://physics.scu.edu.cn/search ... 1%66%61%64%74%6A%6D
http://www.ie.sjtu.edu.cn/?s=%E8 ... 2%77%70%76%62%69%66
http://physics.scu.edu.cn/search ... F%70%6D%65%6E%6F%72
http://www.ie.sjtu.edu.cn/?s=%E9 ... 5%6F%67%6A%62%73%61
http://physics.scu.edu.cn/search ... 3%79%62%64%74%6D%61
http://www.ie.sjtu.edu.cn/?s=%E9 ... 0%65%78%6D%61%6E%62
http://physics.scu.edu.cn/search ... F%66%79%62%71%67%74
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%6C%69%61%73%6A
http://physics.scu.edu.cn/search ... F%63%6C%64%6A%65%6B
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%74%7A%65%7A%71%76
http://physics.scu.edu.cn/search ... 3%72%74%6A%6B%79%6E
http://www.ie.sjtu.edu.cn/?s=%E7 ... 0%8F%77%6B%63%75%7A
http://physics.scu.edu.cn/search ... F%6A%67%61%73%7A%70
http://www.ie.sjtu.edu.cn/?s=%E4 ... 5%6E%75%61%6C%63%66
http://physics.scu.edu.cn/search ... 0%8F%65%74%6D%66%6C
http://www.ie.sjtu.edu.cn/?s=%E6 ... 3%69%72%77%6F%76%7A
http://physics.scu.edu.cn/search ... 7%7A%71%75%61%73%63
http://physics.scu.edu.cn/search ... B%64%76%6E%79%72%78
http://physics.scu.edu.cn/search ... 0%8F%62%6B%6F%70%71
http://physics.scu.edu.cn/search ... F%71%75%78%61%66%68
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%77%72%62%76%73%6C
http://physics.scu.edu.cn/search ... D%75%69%6A%78%6D%6F
http://www.ie.sjtu.edu.cn/?s=%E6 ... D%6A%66%76%77%79%6D
http://www.ie.sjtu.edu.cn/?s=%E5 ... 7%77%6D%6F%63%73%76
http://physics.scu.edu.cn/search ... 0%8F%77%74%6A%7A%70
http://www.ie.sjtu.edu.cn/?s=%E6 ... 2%73%67%74%68%76%63
http://physics.scu.edu.cn/search ... 5%62%67%78%62%6A%6D
http://www.ie.sjtu.edu.cn/?s=%E4 ... 0%8F%61%66%6B%70%66
http://physics.scu.edu.cn/search ... 3%72%75%78%7A%73%6A
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%76%64%68%6C%6E%63
http://physics.scu.edu.cn/search ... 0%8F%62%6C%73%6D%66
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%8F%6C%71%79%7A%7A
http://physics.scu.edu.cn/search ... 0%8F%70%63%77%75%65
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%8F%73%63%67%6D%6E
http://physics.scu.edu.cn/search ... 0%8F%63%69%79%75%6C
举报