《C语言程序设计》-2-07-循环结构.pptxVIP

  • 13
  • 0
  • 约1.06万字
  • 约 49页
  • 2016-12-07 发布于浙江
  • 举报
循环结构程序设计本 章 要 点循环语句的执行流程 while 语句 for 语句 do-while 语句 掌握简单算法设计 输出简单图形 穷举法§6.1 循环概念循环 反复执行同一段程序,直到满足一定的条件后才停止执行该段程序。C语言中控制循环的语句:whilefordo-while§6.2 while语句while语句格式while ( 表达式 )语句; §6.2 while语句例C3_5101.C 从键盘输入10个整数,求这10个整数之和。开始程序主体累加器total=0while ( count10 ){ count++; scanf(%d, num); total += num;}计数器count=0不成立count10?成立count=count+1输出结果total输入numtotal += num结束§6.2 while语句 #include stdio.hint main ( ){ int count,num,total; /* count:计数器,num:输入的整数 */ count=0; total=0; /* total:存放累加和 */ while ( count10 ) /* 循环控制条件 */ { count ++; /* 循环体 */ printf (Enter the No.%d=, count);

文档评论(0)

1亿VIP精品文档

相关文档