solution.json 2.1 KB
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "91f425ad15174f85978143e8db3ae5f6",
  "keywords": "数学,三角形",
  "title": "判断是否能组成三角形",
  "desc": [
    {
      "content": "\n<p>根据输入的三角形的三边判断是否能组成三角形&#xff0c;若可以则输出它的周长和三角的类型</p>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include<stdlib.h>\n#include<stdio.h>\nint main(void)\n{\n\tint num1,num2,num3;\n\tprintf(\"请输入第一条边:\");\n\tscanf(\"%d\",&num1);\n\tprintf(\"请输入第二条边:\");\n\tscanf(\"%d\",&num2);\n\tprintf(\"请输入第三条边:\");\n\tscanf(\"%d\",&num3);\n\tif(num1+num2>num3&&num2+num3>num1&&num1+num3>num2)\n\t{\n\t\tif (num1*num1+num2*num2==num3*num3||num2*num2+num3*num3==num1*num1||num1*num1+num3*num3==num2*num2){\n\t\t\tprintf ( \"%d、%d和%d可以组成直角三角形。\\n \" ,num1,num2,num3);\n\t\t\tprintf (\"三角形周长:%d\\n\",num1+num2+num3);\n\t\t}\n\telse if (num1*num1+num2*num2<num3*num3||num2*num2+num3*num3<num1*num1||num1*num1+num3*num3<num2*num2)\n\t\t\t{\n\t\t\t\tprintf (\"%d、%d和%d可以组成锐角三角形。\\n\" ,num1,num2,num3);\n\t\t\t\tprintf (\"三角形周长:%d\\n\",num1+num2+num3);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintf (\"%d、%d和%d可以组成钝角三角形\\n\" ,num1,num2,num3);\n\t\t\t\tprintf (\"三角形周长:%d\\n\",num1+num2+num3);\n\t\t\t}\n\t}\n\telse\n\t\tprintf(\"%d, %d和%d不能组成三角形。\\n\",num1,num2,num3);\n\tsystem(\"PAUSE\");\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-6141961c2aea43338135ba51d2542d23",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600469958"
}