第13天 高级程序流程控制.pptVIP

  • 1
  • 0
  • 约4.65千字
  • 约 18页
  • 2017-08-16 发布于贵州
  • 举报
第13天 高级程序流程控制 13.1 提早结束循环 for、while、do...while通常都是在满足一定条件时结束循环,还可以进一步地控制循环。 13.1.1 break语句 break语句只能位于for、while、do...while和switch语句中。 执行break语句后,就会退出以上的当前语句块,语句块中break后面的语句就不会执行。 #include stdio.h main ( ) {int count ; for (count = 0 ; count 10 ; count ++) {if ( count == 5 ) break ; printf (count = %d\n , count) ; } } 清单13.1 breaking.c #include stdio.h char s[] = This is a test string. It contains two sentences.; int main( void ) { int count; printf(\nOriginal string: %s, s); for (count = 0; s[count]!=\0; count++) { if (s[count] == .) { s[count

文档评论(0)

1亿VIP精品文档

相关文档