#include<stdio.h>
#include<cmath>
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
int main()
{
int x,y
scanf("%d",&x)
if(0<x&&x<10) y=3*x+2
else
{if(x=0) y=0
else
{if (x<0) y=x*x
else printf("go die\n")
}
}
printf("%d",y)
return 0
f(x)=3x+2 (0<x<10)
f(x)=1 (x=0)
f(x) = x*x (x<0)
#include <stdio.h>
#include <math.h>
void main()
{
float x
double y
printf("Please input the value of x:")
scanf("%f",&x)
if(x>=-10&&x<=4)
{
y=fabs(x-2)
printf("y=%.2f\n",y)
}
else if(x>=5&&x<=7)
{
y=x+10
printf("y=%.2f\n",y)
}
else if(x>=8&&x<=12)
{
y=pow(x,4)
printf("y=%.2f\n",y)
}
else
printf("No answer\n")
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)