跳至主要內容

06.程序流程结构

约 81 字小于 1 分钟

循环

for
do while
while

判断

if
else if
else
switch

goto语句

#include <iostream>
using namespace std;
int main ()
{
   // 局部变量声明
   int a = 10;
   // do 循环执行
   LOOP:do
   {
       if( a == 15)
       {
          // 跳过迭代
          a = a + 1;
          goto LOOP;
       }
       cout << "a 的值:" << a << endl;
       a = a + 1;
   }while( a < 20 );
   return 0;
}