/*。
*Copyright(c)2014,烟台大学计算机学院
*All right reserved,
*文件名:test.cpp
*作者:buyutang
*完成日期:2014年10月15日
*版本号:v1.0
*
问题描述:
*输入描述:输入x
*程序输出:输出Y
*/#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double x,y;
cin>>x;
if (x<2)
y=x;
else if(x>=2&&x<6)
y=x*x-1;
else if(x>=6&&x<10)
y=sqrt(x+1);
else if(x>=10)
y=1/(x+1);
cout<<"y="<<y<<endl;
return 0;
}
知识点总结:
在这个程序中,自已得到了对if-else语句的练习。
学习心得:
有兄弟,不孤单。自己终于在兄弟的帮助下完成了一篇正规的博文。