第九周上级任务之分段函数求解
2012-10-22 19:04
267 查看
#include <iostream> #include<cmath> using namespace std; int main() { float x,y; cin>>x; if(x<0) cout<<"Input error!"<<endl; else if(0<=x&&x<2) y=x; else if(2<=x&&x<6) y=x*x+1; else if(6<=x&&x<10) y=sqrt(x+1); else y=1/(x+1); cout<<"x="<<x<<",y="<<y<<endl; return 0; }
相关文章推荐
- 第九周第一任务:分段函数求值
- 第九周上机任务项目1:分段函数求值
- C++第13周报告(一)用函数完成分段数学函数的求解
- 二次函数求解(第九周上机任务)
- 第九周上级任务——分段函数求值
- 第九周实验报告任务4 建立一个二维数组类Douary,使该类中有以下数据成员、成员函数及友员函数,完成矩阵的输入、输出、加、减、相等判断等操作。
- 体会函数参数传递(第十七周上级任务)
- 第九周上机任务(用if-else语句求解分段函数)
- 第九周任务五 一元一次函数的求解
- C++ 第九周任务-二次函数求解
- 第13周报告1:用函数完成分段数学函数的求解
- 第13周报告1:用函数完成分段数学函数的求解
- 第九周上级任务之每月天数问题
- 第九周任务四之 建立一个二维数组类Douary,使该类中有以下数据成员、成员函数及友员函数,完成矩阵的输入、输出、加、减、相等判断等操作。
- 第九周上级任务之二个人所得税计算器
- 第九周任务四(建立一个二维数组类Douary,使该类中有以下数据成员、成员函数及友员函数,完成矩阵的输入、输出、加、减、相等判断等操作。)
- 分段函数求解
- 第九周上级任务--个人所得税计算器
- 第13周报告1:用函数完成分段数学函数的求解
- 函数调用求解分段函数