{ "question_id": 7449614, "question_title": "计算函数的值", "question_content": "

编程输入实数x,计算下面函数的值,并输出y的值,并输出y的值;\nx2         x<1\n3x-1      1≦x≦10\nx/5        x>10

", "difficulty": "简单", "answer_id": 53429821, "answer_content": "

代码如下,请采纳,谢谢,不明白地方随时交流

\n\n
\n# include<stdio.h>\n# include<stdlib.h>\n\nint main(void)\n{\n\tfloat x,y;\n\n\tprintf("请输入x的值:\\n");\n\tscanf("%f",&x);\n\n\tif(x<1)\n\t{\n\t\ty = x * x;\n\t}\n\telse if(x<=10)\n\t{\n\t\ty=3*x-1;\n\t}\n\telse\n\t{\n\t\ty= x / 5;\n\t}\n\n\tprintf("y的值为:%f\\n",y);\n\n\tsystem("pause");\n\treturn 0;\n}
\n\n

 

\n", "tag_name": "c++", "cpp": "# include\n# include\nint main(void)\n{\n\tfloat x,y;\n\tprintf(\"请输入x的值:\\n\");\n\tscanf(\"%f\",&x);\n\tif(x<1)\n\t{\n\t\ty = x * x;\n\t}\n\telse if(x<=10)\n\t{\n\t\ty=3*x-1;\n\t}\n\telse\n\t{\n\t\ty= x / 5;\n\t}\n\tprintf(\"y的值为:%f\\n\",y);\n\tsystem(\"pause\");\n\treturn 0;\n}", "topic_link": "https://bbs.csdn.net/topics/600470171", "status": 1, "keywords": "算法初阶,基础知识,函数的增长,标准记号与常用函数", "license": "csdn.net", "notebook": { "cpp": "https://codechina.csdn.net/csdn/csdn-daily-code/-/jupyter/master/data/notebook/answer/ipynb/cpp/91.ipynb?type=file" }, "notebook_enable": 1 }