{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "926861f9153c43fbb4b93e5ee1ec2d2a",
  "keywords": "算法中阶,贪心算法,活动选择问题,高级设计和分析技术",
  "title": "水果计费系统",
  "desc": [
    {
      "content": "\n<p>本关任务&#xff1a;编写程序&#xff0c;有五种水果&#xff0c;apple、banana、orage、strawberry、pear&#xff0c;每一种有一个价格&#xff08;浮点小数&#xff09;&#xff0c;由老板输入&#xff0c;请提示用户选择什么水果&#xff0c;购买数量&#xff08;按照斤两&#xff09;&#xff0c;然后将总价显示出来。</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\ttypedef enum {apple, banana, orange, strawberry, pear} fruits;\n\tdouble prices[5];\t\t\t \n\tfruits purchase;\t\t\t \n\tint fruit;\t\t\t\t   \n\tdouble amount;\t\t\t   \n\tfor(int i = 0; i < 5; i++)\n\t\tscanf(\"%lf\", &prices[i]);\n\tprintf(\"水果编号：1.苹果  2.香蕉  3.橘子  4.草莓  5.梨\\n\");\n\tprintf(\"请输入购买的水果(1~5)，以及购买数量（按照斤两）：\\n\");\n\tscanf(\"%d %lf\", &fruit, &amount);\n\tpurchase = (fruits)fruit;\t \n\tprintf(\"总价为：%.3lf\", prices[purchase-1]*amount);\n\treturn 0; \n}",
    "language": "cpp"
  },
  "node_id": "dailycode-f40f4ecc0b244fa186aff0bfb9976b7c",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600470173"
}