学习第5.2天

C语言

  1. if——选择结构的代表语句、判断条件的

    1. if

    2. if else (此外的意思)

    3. if else if else、

    4. int num = 100;
      	int cost = 0;
      	if (num > 200)
      		cost = 1;
      	else if (num > 300)
      		cost = 2;
      	else if (num > 80)
      		cost = 3;
      	else if (num > 70)
      		cost = 4;
      	else
      		cost = 5;
      	printf("tiaoc");
      
    5. if 后面都有表达式、一般为逻辑表达式或者关系表达式、可以单独使用if语句、没有else、但是else不能单独使用、

    6. 、if语句可以嵌套、if里面包含if、

    7. else和if的配对、else总和上一个未配对的if配对、

原文地址:https://www.cnblogs.com/chengyaohui/p/13554880.html