當x0且汪態碰 x≠3 時 y=x*x +x-6
創新互聯公司是一家從事企業網站建設、成都做網站、網站制作、行業門戶網站建設、網頁設計制作的專業網站建設公司,擁有經驗豐富的網站建設工程師和網頁設計人員,具備各種規模與類型網站建設的實力,在網站建設領域樹立了自己獨特的設計風格。自公司成立以來曾獨立設計制作的站點上千家。
當 0=x0且x≠2及x≠3時 y=x*2-5x+6
當 x=其困談他 時 y=x*2-x-1
請問樓主,這是怎么分段的?當x0且 x≠3?x0還用且x不等于3嗎?0=x0?什么數不但閉桐大于等于0而且小于0?
#includestdio.h
#includemath.h
void main()
{
float x,y;
scanf("%f",x);
if(x0x!=3)
y=x*x+(x-6);
else if(x=0x!=2x!=3)
y=x*x-(5*x)+6;
else
y=x*x-x-1;
printf("%f",y);
}
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
#include櫻鍵math.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(score舉敗0 || 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 math.h
int main()
{
double x,y;
scanf("%lf",x);
if (x0)
y=0.5*(-x);
else
if (x10)
y=exp(x)+3;
else
if(x20)
y=log10(x);
else
if (x30)
y=pow(x,1.5);
else
if (x50)
y=pow (x,0.5)-1;
else
y=3*cos(x);
printf("y=%lf\n",y);
return 0;
}
擴展資料
return 0代表程序正常退出。return是C++預定義的語句,它提供了終止函數執行的一種方式。當return語句提供了一個值時,這個值就成為函數的返回值。
return語句用來結束循環,或返回一個函數的值。
1、陸哪return 0,說明程序正常退出,返回到主程散逗序繼續往下執行。
2、return 1,說明程序異常退出,返回主調函數來處理,繼續沖悉賣往下執行。return 0或return 1對程序執行的順序沒有影響,只是大家習慣于使用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;
}
運行樣例: