2020
10-08
10-08
C语言中do-while语句的2种写法示例
while循环和for循环都是入口条件循环,即在循环的每次迭代之前检查测试条件,所以有可能根本不执行循环体中的内容。C语言还有出口条件循环(exit-conditionloop),即在循环的每次迭代之后检查测试条件,这保证了至少执行循环体中的内容一次。这种循环被称为dowhile循环。看下面的例子:#include<stdio.h>intmain(void){constintsecret_code=13;intcode_entered;do{printf("Toenterthetriskaidekaphobiatherapy...
继续阅读 >