zoukankan      html  css  js  c++  java
  • 程序流程结构——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;

    }

  • 相关阅读:
    数据结构与算法—栈和队列
    数据结构与算法—双向链表
    数据结构与算法—单向循环链表
    hashMap高低位异或原理
    MySQL中order by排序时,数据存在null,排序在最前面
    Class.getSimpleName()的作用
    Linux密码过期问题,即WARNING:Your password has expired
    CSS

    easyexcel注解
  • 原文地址:https://www.cnblogs.com/wanghong19991213/p/13454819.html
Copyright © 2011-2022 走看看