{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "2b2ef20f0be545bf89115f683d131db8",
  "keywords": "B树,算法高阶,高级数据结构,B树上的基本操作",
  "title": "if else 和 switch 使用",
  "desc": [
    {
      "content": "\n<p>输入学生成绩&#xff0c;\n若成绩在95分以上&#xff0c;输出“A”&#xff1b;\n若成绩在85~94分&#xff0c;输出“B”&#xff1b;\n若成绩在75~84分&#xff0c;输出“C”&#xff1b;\n若成绩在65~74分&#xff0c;输出“D”&#xff1b;\n若成绩在65分以下&#xff0c;输出“E”。&#xff08;分别用if else 和 switch 语句完成&#xff09;</p>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include \"stdio.h\" \nint main(){\n\tint score;\n\tscanf(\"%d\",&score);\n\tif(score>=95){\n\t\tprintf(\"A\\n\");\t\n\t}else if(score>=85 && score<=94){\n\t\tprintf(\"B\\n\");\n\t}else if(score>=75 && score<=84){\n\t\tprintf(\"C\\n\");\n\t}else if(score>=65 && score<=74){\n\t\tprintf(\"D\\n\");\n\t}else{\n\t\tprintf(\"E\\n\");\n\t}\n\tprintf(\"以下用switch语句实现相同功能\\n\");\n\tscore = score-5;\n\tscore = score/10;\n\tswitch(score){\n\t\tcase 9:\n\t\t\tprintf(\"A\\n\");\t\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tprintf(\"B\");\t\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tprintf(\"C\\n\");\t\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tprintf(\"D\\n\");\t\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tprintf(\"E\\n\");\n\t\t\tbreak;\n\t}\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-76e2e197fa8044a5939dc87d01245e2d",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600470148"
}