| 5 | 1/1 | 返回列表 |
| 查看: 2033 | 回復: 8 | ||
| 當前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | ||
renchong銀蟲 (小有名氣)
|
[求助]
一個區(qū)間搜索的c語言程序 出問題了
|
|
|
我寫了個搜索 大-小-大 區(qū)間的程序 ,但最后運行結果始終是錯的,不清楚哪里有問題(演算過 邏輯上是正確的)求蟲友們幫幫忙 #include main() { int a,b,x0,x1,x2,h,f0,f1,f2; printf("please input the number\n" ;scanf("x0=%d,h=%d",&x0,&h); x1=x0+h; f1=f(x1); f0=f(x0); if(f1 h=2*h; x2=x0+h; f2=f(x2); for(f1,f2;f2 x0=x1; x1=x2; x2=x1+h; f0=f(x0); f1=f(x1); f2=f(x2); } a=x0; b=x2; } else { h=-h; x2=x0+h; f2=f(x2); for(f0,f2;f2 x1=x0; x0=x2; x2=x0+h; f0=f(x0); f1=f(x1); f2=f(x2); } a=x2; b=x1; } printf("a=%d,b=%d\n",a,b); getch(); } int f(int n) { return 2+n^2; } |
木蟲 (著名寫手)

木蟲 (知名作家)

木蟲 (著名寫手)

木蟲 (著名寫手)

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 調(diào)劑 +4 | GK72 2026-03-30 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 085600,專業(yè)課化工原理,320分求調(diào)劑 +5 | 大饞小子 2026-03-29 | 5/250 |
|
|
[考研] 材料學碩333求調(diào)劑 +14 | 北道巷 2026-03-24 | 14/700 |
|
|
[考研] 334分 一志愿武理 材料求調(diào)劑 +16 | 李李不服輸 2026-03-26 | 16/800 |
|
|
[考研] 0703化學/290求調(diào)劑/本科經(jīng)歷豐富/工科也可 +13 | 丹青奶蓋 2026-03-26 | 15/750 |
|
|
[考研] 337求調(diào)劑 +6 | 《樹》 2026-03-29 | 6/300 |
|
|
[考研] 求調(diào)劑 +10 | 張zz111 2026-03-27 | 11/550 |
|
|
[考研] 290求調(diào)劑 +3 | dfffsar 2026-03-29 | 3/150 |
|
|
[考研] 311求調(diào)劑 +6 | 冬十三 2026-03-24 | 6/300 |
|
|
[考研] 一志愿南昌大學324求調(diào)劑 +5 | hanamiko 2026-03-29 | 5/250 |
|
|
[考研] 一志愿雙一流機械285分求調(diào)劑 +4 | 幸運的三木 2026-03-29 | 5/250 |
|
|
[考研] 291求調(diào)劑 +5 | Y-cap 2026-03-29 | 6/300 |
|
|
[考研] 349求調(diào)劑 +6 | 李木子啊哈哈 2026-03-25 | 6/300 |
|
|
[考研] 356求調(diào)劑 +4 | gysy?s?a 2026-03-28 | 4/200 |
|
|
[考研] 298求調(diào)劑 +4 | 種圣賜 2026-03-28 | 4/200 |
|
|
[考研] 070300求調(diào)劑306分 +4 | 26要上岸 2026-03-27 | 4/200 |
|
|
[考研] 調(diào)劑 +3 | 好好讀書。 2026-03-28 | 3/150 |
|
|
[考研] 279 分 求調(diào)劑 +4 | 睡個好覺_16 2026-03-24 | 4/200 |
|
|
[考研] 324求調(diào)劑 +5 | hanamiko 2026-03-26 | 5/250 |
|
|
[考研] 336材料求調(diào)劑 +7 | 陳瀅瑩 2026-03-26 | 9/450 |
|