1樓:生秋
第一題:
#include
int main()
第二題#include
#include
int main()
第三題邏輯沒錯,不過忘記加**費了
#include
#include
int main()
第四題#include
#include
int main()
第五題測試資料沒加逗號的,相加可以修改scanf#include
#include
int main()
printf("%.2f\n", (sum-min-max) / 3);
return 0;}
2樓:
(1)不行。要if(ch>='0' && ch<='9')才行。
(2)不行。要double function (double x,double y)才行。
(3)不行。要double function***(int x) else if(x>=10 && x<50) else if(x>=50) if (y>170) return y;}才行。
(4)不行。要double function***(int x)else if(x>-1 && x<2)else if(x>=2 && x<=10)else if(x>10)return y;}才行。注:
x<=2 && x>=10不會成立,有改動。
(5)//#include "stdafx.h"//vc++6.0加上這一行.
#include "stdio.h"
void main(void)
printf("the result is %.1f\n",(sum-max-min)/3.0);}
3樓:匿名使用者
1) 只能說明 小數部分是0 ,,,,不過應該滿足你的題意
(2) 編寫乙個程式實現如下功能,即:求y2+x2的運算結果,x,y為整數,由鍵盤輸入
#include
#include
int function(int x,int y)
int main()
(3) 編寫程式,根據上網時間x計算上網費用y,計算的方法如下:
•當x< 10小時,上網費用: y=20元**費
•當10<=x<50小時,上網費用:**費加超過10小時部分每小時3元。
•當x>=50小時,上網費用:**費加超過10小時部分每小時2.5元
•同時為了鼓勵多上網,每月收費最多不超過170元。
總之邏輯呢就是
#include
int ***(int x)
else if(x>=10 && x<50)
else if(x>=50)
if (x>170)
return y;
}int main()
求c語言版。。
4.編寫程式,從鍵盤輸入x值,根據下列分段函式式計算出y的值。
邏輯是這樣的:
#include
int ***(int x)
elseif(x>-1 && x<=2)
elseif(x<=2 && x>=10)
elseif(x>10)
return y;
}int main()
5.編寫程式,從鍵盤輸入5個實數,去掉乙個最大值,去掉乙個最小值,求其他三個數的平均值(輸出時要求保留一位小數.)
p如輸入2.1,3.5,4.3,1.9,3.7。p則輸出3.5+2.1+3.7的平均值:3.1。
#include
int main()
printf("%.1f",(sum-max-min)/3);
}希望能幫到你。。
4樓:匿名使用者
顧地博導二疊紀與世隔絕
5樓:苑永修千月
25題是這樣的
由於是do
while語句,當i=2時執行該語句,n++為1,當i=3時,由於取餘等於0,則跳出該迴圈,n還是為1,沒有變,當i=4時和i=2時一樣,n++變為2,由於是do
while語句i等與5時繼續迴圈下去,n++變為3,然後遇到whlie(!i
)不合乎條件,結束該迴圈。又遇到n++,則n就變為4了。
求解這幾道c語言題的答案
6樓:塗晉飛
同志,拜託把問題說清楚一點,你的解釋前後矛盾,讓我不知所云,對不起,剛才沒看清楚,請別介意;答案我已經做出來了:
#include
#include
#include
#define m 80
void proc(char str,char b,char c)i=0;/*第乙個空*/
if(n%2)
b[j]='\0';
}else
b[j-1]='\0';/*第三個空*/}}void main()
/*enter the string:
abcabcabcab
enter the characer of the string deleted:b
the new string is :abcabca*//*enter the string:
abcabcabca
enter the characer of the string deleted:b
the new string is :abcabcabca*/
7樓:匿名使用者
拜託,你別把別人不當人看。
c語言 幾道選擇題,C語言 幾道選擇題
1 a2 c 3 a4 c 5 c6 d 7 c8 d 9 c10 d 11 c 12 c 15 d 呵呵 我來幫幫你 1.a2.d 3.a4.這一題要看你的c的執行環境,不同的環境出來的結果可能不同5.b6.d 7.b8.d 9.c10.d 11.b 12.c 15.c 搞定,錯了被打板了可不能怪...
幾道簡單的C語言題目,幾道初學者的c語言題目
2 b3 c4 a 5 b6 b 7 c8 c 9 c10 b 11 a 12 a 13 c 14 c 15 a 16 d 17 b 18 b 19 b 幾道初學者的c語言題目 幾道簡單的c語言程式設計題,請高手幫忙 1 求1 3 5 7 99 101的值e68a8462616964757a6869...
幾道c語言基礎的選擇題求解釋謝謝
路易五十三 1 首先我們知道巨集只是簡單的字元替換,那麼巨集num實際就等價於 n 1 1 n 1 2,再等價於 2 1 1 2 1 2,然後要注意優先順序的問題,num 8,那麼迴圈就是1 8。2 a p 就是a 0 b a 10 這樣就越界了,陣列元素只有a 0 a 9 c a 就是a 0 d ...