#include "stdio.h"
網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、小程序定制開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了炎陵免費(fèi)建站歡迎大家使用!
#includemath.h
void main()
{
double x,y,f,h;
printf("請(qǐng)輸入x:\n");
scanf("%lf",x);
printf("請(qǐng)輸入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);
}
寫法1
if (x-5 x0) y = x;
if (x == 0) y=x-1;
if (x0 x10) y = x+1;
寫法2
if (x-5 x10)
{
y=x; //在這個(gè)范圍,不論怎樣,先把y賦值為x
if (x=0) //在這個(gè)范圍,需要對(duì)y值做修改
{
y = y-1; //先把y-1再說(shuō),對(duì)應(yīng)x=0的情況,如果x!=0,那么我們?cè)俅涡薷?/p>
if(x0)
y = y+2; //剛剛y-1了,所以需要+2
}
}
寫法3,終于是正常點(diǎn)的做法了
if (x-5 x0) y=x;
else
{
if (x10)
{
if (x==0) y=x-1;
else y=x+1;
}
}
寫法4
switch(x)
{
case 0:
y=x-1;
break;
case -4;
case -3;
case -2;
case -1;
y=x;
break;
case 1;
case 2;
case 3;
case 4;
case 5;
case 6;
case 7;
case 8;
case 9;
y=x+1;
break;
}
int?sign(int?x)
{
int?y;
scanf("%d",x);
if(x0)
y=1;
else?if(x==0)//判斷語(yǔ)句是==不是=號(hào)
y=0;
else
y=-1;
return?y;
}
1. 代碼如下,3)需要實(shí)際運(yùn)行時(shí)輸入測(cè)試
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;
}
名稱欄目:c語(yǔ)言計(jì)算分段函數(shù)概念 c語(yǔ)言計(jì)算分段函數(shù)例題
URL分享:http://jinyejixie.com/article2/dopppoc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、企業(yè)網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、用戶體驗(yàn)、網(wǎng)站制作、關(guān)鍵詞優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)