大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
#include
成都创新互联专注为客户提供全方位的互联网综合服务,包含不限于成都网站建设、做网站、铅山网络推广、成都微信小程序、铅山网络营销、铅山企业策划、铅山品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;成都创新互联为所有大学生创业者提供铅山建站搭建服务,24小时服务热线:028-86922220,官方网址:www.cdcxhl.com
int main()
{
int x,y;
scanf("%d",x);
if(0xx10) y=3*x+2;
else
{if(x=0) y=0;
else
{if (x0) y=x*x;
else printf("go die\n");
}
}
printf("%d",y);
return 0;
}该程序的分段函数如下:
f(x)=3x+2 (0x10)
f(x)=1 (x=0)
f(x) = x*x (x0)
#include stdio.h
#include math.h
void main()
{
float x;
double y;
printf("Please input the value of x:");
scanf("%f",x);
if(x=-10x=4)
{
y=fabs(x-2);
printf("y=%.2f\n",y);
}
else if(x=5x=7)
{
y=x+10;
printf("y=%.2f\n",y);
}
else if(x=8x=12)
{
y=pow(x,4);
printf("y=%.2f\n",y);
}
else
printf("No answer\n");
}
1. 代码如下,3)需要实际运行时输入测试
int main(void)
{
double x, y, f;
printf("Please input 2 double number in the form of x y:\n");
scanf("%lf%lf", x, y);
if(x=0 y0)
f = 2*x*x + 3*x +1/(x+y);
else if(x=0 y=0)
f = 2*x*x + 3*x +1/(1+y*y);
else
f = 3*sin(x+y)/(2*x*x) + 3*x + 1;
printf("x=%lf, y=%lf, f(x, y)=%lf\n", x, y, f);
return 0;
}
2.代码如下
#include stdio.h
#includemath.h
int main(void)
{
double x, y, f;
printf("Please input 2 double number in the form of x y:\n");
scanf("%lf%lf", x, y);
if(x=0)
{
if(y0)
f = 2*x*x + 3*x +1/(x+y);
else
f = 2*x*x + 3*x +1/(1+y*y);
}
else
f = 3*sin(x+y)/(2*x*x) + 3*x + 1;
printf("x=%lf, y=%lf, f(x, y)=%lf\n", x, y, f);
return 0;
}
3.代码如下
#include stdio.h
int main(void)
{
int score = 0;
printf("Please input a score between 0-100:\n");
scanf("%d", score);
if(score0 || score100)
printf("Wrong input of score!\n");
else if(score=90 score=100)
printf("A\n");
else if(score=80 score=89)
printf("B\n");
else if(score=70 score=79)
printf("C\n");
else if(score=60 score=69)
printf("D\n");
else
printf("E\n");
return 0;
}
int Fun1(int num)
{
if(num 0)
{
return num;
}
else if(num 10)
{
return num - 10;
}
else
{
return num + 10;
}
}
int Fun2(int num)
{
if(num 10)
{
if(num 0)
{
return num;
}
else
{
return num -10;
}
}
else
{
return num +10;
}
}
int Fun3(int num)
{
switch(num0)
{
case 0:
{
switch(num10)
{
case 0:
return num +10;
case 1:
return num - 10;
}
}
case 1:
return num;
}
}
帮你改了下代码,VC6测试通过,自己看看吧。
#includestdio.h
int main()
{
float x,y;//根据给定的测试用例,x,y应该为float型
scanf("%f",x);//x为float型,所以改为%f
if(x20)
{
y=x+100;
}
else if(x=20x=100)
{
y=x;
}
else
y=x-100;
printf("x=%f,y=%f\n",x,y);
return 0;//缺少分号
}