重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
帮你改了下代码,VC6测试通过,自己看看吧。
10多年的永善网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都营销网站建设的优势是能够根据用户设备显示端的尺寸不同,自动调整永善建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联公司从事“永善网站设计”,“永善网站推广”以来,每个客户项目都认真落实执行。
#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;//缺少分号
}
#include "stdio.h"
#include "math.h"
int main(int argc,char *argv[]){
double x,y;
printf("Input x(R:)...\nx=");
scanf("%lf",x);
if(x5)
y=-x+3.5;
else if(x=5 x10)
y=20-3.5*pow(x+3,7);//这里看着像7,是几就把7改成几
else
y=-3.5+sin(x);
printf("y = %g\t(x==%g)\n",y,x);
return 0;
}
运行样例:
#include
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;
}
#include "stdio.h"
#includemath.h
void main()
{
double x,y,f,h;
printf("请输入x:\n");
scanf("%lf",x);
printf("请输入y:\n");
scanf("%lf",y);
if((x=0)(y0))
f=2*pow(x,2)+3*x+1/x+y;
else if((x=0)(y=0))
f=2*x*x+3*x+1/x+y*y;
else
f=3*sin(x+y)/2/pow(x,2)+3*x+1;
printf("x=%lf,y=%lf,f=%lf\n",x,y,f);
h=pow(x,2);
printf("%lf",h);
}