#include
#include
int main()
{
float x,y;
scanf("%f",&x);
if (x<=-1){
y=3*sqrt(-x+2)+1;
printf("%.5f",y);}
else if (x>=10){
y=sqrt((x+1)/(2*x*x));
printf("%f",y);}
else{
y=pow(x,5)+1;
printf("%.0f",y);}
}
扩展资料
using namespace std;
class CStudent
{
public:
char szName[20];
int age;
};
int main()
{
CStudent s;
fstream ioFile("students.dat", ios::in|ios::out);//
if(!ioFile) {
cout << "error" ;
return 0;
}
#include
#include
#include
int main()
{
float x; //输入应该是float 类型。
while(1){
scanf("%f",&x);
if(x<=-1) {printf("%g\n",sin(x)+2*cos(x));} // sin( x ) 要加上括号 。 printf 要用 %g 或者 %f 作为输出格式这样才能输出小数
else if(x<=1) printf("%g\n",1/(x^2-1));
else printf("%g\n",sqrt(x^3-1));
}
}
#include
#include
#include
int main()
{
float x; //输入应该是float 类型。
while(1){
scanf("%f",&x);
if(x<=-1) {printf("%g\n",sin(x)+2*cos(x));} // sin( x ) 要加上括号 。 printf 要用 %g 或者 %f 作为输出格式这样才能输出小数
else if(x<=1) printf("%g\n",1/(x^2-1));
else printf("%g\n",sqrt(x^3-1));
嗯。。。。。。。。。。。。。初三的,不会
华电的孩子伤不起,呵呵。其实,如果你只是sin和cos无法识别的话就改成sin()和cos()就可以了。很简单。对了,你第二题做出来没有?给个参考撒。。。