Study day 7

Time:2022-5-13

C language

  1. Loop control statement

  2. Goto statement

    1. Unconditional turn statements

    2. Goto generally forms a circular structure with if statements

    3. int	a = 1, sum = 0;
      	tiao:
      	if (a <= 200)
      	{
      		sum = sum + a;
      		a++;
      		goto tiao;
      
      	}
      	printf("%d", sum);
    4. Goto — cannot be used across functions

    5. Jumping from inside the circulatory system to outside the circulatory system will destroy the principles of structured programming

  3. Statement while

    1. While: judge first and then execute. When the type of loop structure

    2. int	a = 1, sum = 0;
      	while (a <= 200)
      	{
      		sum = sum + a;
      		a++;
      	}
      	printf("%d", sum);
      //The effect is the same as goto statement
  4. Do while statement

    1. Until the loop statement, – do while

    2. int	a = 1, sum = 0;
      	do
      	{
      		sum = sum + a;
      		a++;
      	} 
      	while (a <= 200);
      	printf("%d", sum);
    3. Execute first and then judge