• 程序流程结构——if语句


    c语言支持最基本的三种运行结构:

    • 顺序结构:程序按顺序执行,不发生跳转
    • 选择结构:根据是否满足条件 ,有选择的执行相应功能 
    • 循环结构:依据条件是否满足,循环多次执行某段代码

    #define _CRT_SECURE_NO_WARNINGS

    #include<stdio.h>

    #include<string.h>

    #include<stdlib.h>

    #include<math.h>

    #include<time.h>

    int main()

    {

      int score;

      scanf("%d",&score); 

    //如果表达式为真,则执行{}对应代码。

    //1.if(表达式){}

    //2.if (表达式){}   else{}

    //3.if (表达式){}   else if(表达式)    else{}

    //4.条件嵌套

      if (score>700)

      {

        printf("恭喜000考生已被我校(xxx大学)录取 ");

        

        if(score>720)

        {

          printf("恭喜000考生已被我校(xxx大学计算机专业)录取 ");

        }  

        

        else if(score>710)

        {

          printf("恭喜000考生已被我校(xxx大学挖掘机专业)录取 ");

        }

        else

        {

          printf("恭喜000考生已被我校(xxx大学母猪产后护理专业)录取 ");

        }

      }

      else if(score>680)

      {

        printf("恭喜000考生已被我校(xx大学母猪产后护理专业)录取 ");

      }

      else

      {

        printf("恭喜000考生已被我校(x大学母猪产后护理专业)录取 ");

      }

         

      return EXIT_SUCCESS;

    }

  • 相关阅读:
    prometheus,alertmanager 报警配置详解
    使用 kubeadm 搭建 kubernetes1.10 集群
    kibana-sentinl-监控报警
    ELK集群模式部署
    mongo 误操作恢复数据
    mongo 实时同步工具 mongosync
    移动端巨坑——iphone6Plus默认设置不使用sessionStorage
    iphone6 Plus seesionStorage失效
    移动端手势拖拽排序神器Sortable.js
    vue使用swiper(转)
  • 原文地址:https://www.cnblogs.com/wanghong19991213/p/13454819.html
Copyright © 2020-2023  润新知