freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

最新c語言程序設(shè)計何欣銘、顏暉第2版課后習(xí)題答案終稿-文庫吧資料

2025-07-04 04:24本頁面
  

【正文】 a = 0 C.a(chǎn) = 10 amp。 習(xí)題參考答案一.選擇題1.能正確表示邏輯關(guān)系: a≥10 或 a≤0181。改寫后:y=x+1 的執(zhí)行條件是 x1。 兩條語句的執(zhí)行條件是什么?改寫后呢?解答:改寫前:y=x+1 的執(zhí)行條件是 x1。 } 練習(xí) 310 在例 312 中,改寫 if 語句前,y= x + 1。 } printf(f(%.2f)=%.2f\n, x, y)。 } else { if(x0) y=0。x)。解答:include int main(void) { double x, y。 } return 0。 default: price=0。 } case 4: price=。 case 3: price=。 case 2: price=。 else { switch(choice){ case 1: price=。choice)。 printf([0] Exit\n)。 printf([3] oranges\n)。 ri++){ printf([1] apples\n)。 for(ri=1。 int choice。當用戶輸入編號 1~4,顯示相應(yīng)水果的單價(保留兩位小數(shù));輸入 0,退出查詢;輸入其他編號,顯示價格為 0。有 4 種水果,蘋果(apples)、梨(pears)、桔子(oranges)和葡萄(grapes),單價分別是 元/公斤, 元/公斤, 元/公斤和 元/公斤。 } return 0。 break。E39。 break。D39。 break。C39。 break。B39。 break。A39。 ch = getchar()。解答:include int main(void) { char ch。例如,輸入 A,輸出 90-100。 } 練習(xí) 36 在例 38 程序中,如果把 switch 語句中所有的 break 都去掉,運行結(jié)果會改變嗎?如果有變化,輸出什么?為什么?解答:如果去掉所有的 break 語句,運行結(jié)果會改變,輸出 price = ,因為不管 choice 值與其中某個常量表達式相等,當去掉 break 語句時,其后的所有語句段都將運行,故每次都將執(zhí)行到 price= 語句為止。 else printf(It is not a leap year\n )。amp。year)。 printf(Enter year: )。判斷閏年的條件是:能被 4 整除但不能被 100 整除,或者能被 400 整除。 return 0。 else other++。\n39。 39。) digit++。 c = 39。 amp。 else if(c=39。Z39。amp。A39。z39。amp。a39。i++){ c = getchar()。 for(i=1。 char c。解答:include int main(void) { int i。 return 0。 } } printf(Grade average = %.2f\n, total / n)。 total = total + grade。 scanf (%lf, amp。 i = n。 count = 0。n)。 printf(Enter n: )。解答: include int main(void) { int count, i, n。 return 0。 else y=1。 if(x0) y=1。 scanf(%d,amp。239。 237。 1, x 0y= sign(x) =239。練習(xí) 32 輸入一個整數(shù) x,計算并輸出下列分段函數(shù) sign(x) 的值。解答:最好再增加兩組測試用例,因為尚未對分段函數(shù)參數(shù)的邊界值進行測試。增加空的 else 語句;歸納總結(jié)本章的各個重要知識點。 else y = x + 2。 } else。每條語句的執(zhí)行條件?if (x 2){ if (x 2)if (x 1) y = x + 1。if (x 2)if (x 1) y = x + 1。 180。計算公式如下,其中:c 表示攝氏溫度,f 表示華氏溫度。要求定義和調(diào)用函數(shù) fact(n)計算 n!,函數(shù)類1.求華氏溫度 150176。 return product。 i = n。 product=1。 } double fact(int n) { int i。 } printf(sum = %.0f\n, sum)。 i = n。 sum = 0。 scanf(%d, amp。 double sum。i !8.編寫程序,輸入一個正整數(shù) n,求型是 double。 27 } return 0。 i++){ sum = sum + pow(2, i)。 for(i = 1。n)。 double sum。 2i7.編寫程序,輸入一個正整數(shù) n,求 i=1 ,可以調(diào)用 pow 函數(shù)求冪。 } return 0。 money = loan * rate * mypow /( mypow 1)。 year = 30。 printf( year money\n)。loan, amp。 double loan, money, mypow, rate。rate + rate)monthmoney loan解答:180??蛻舸蛩阍?5~30 年的范圍內(nèi)選擇還清貸款的年限,想得到一張“還款年限-月還款額表”以供參考。 return 0。 } 1 + + 2 3 4 5 6 + .....3 5 7 9 11的前 n 項之和。 sum = sum + item。 i = n。 flag = 1。n)。 double item, sum。 } i。 printf(sum = %.6f\n, sum)。 i = n。 sum = 0。m, amp。 double sum。 } n229。 printf(%.2f\n, mypow)。 i = n。 mypow = 1。x, amp。 double mypow, x。 } 3.編寫程序,輸入實數(shù) x 和正整數(shù) n,計算 xn,不允許調(diào)用 pow 函數(shù)求冪。 printf(cost = %.2f\n, cost)。 if(e = 50) cost = * e。 scanf(%lf, amp。 scanf(%d, amp。編寫程序,輸入用戶的月用電量(千瓦時),計算并輸出該用戶應(yīng)支付的電費(元)。 return 0。 printf(%d / %d = %d\n, num1, num2, num1/num2)。 printf(%d %d = %d\n, num1, num2, num1num2)。num2)。 scanf(%d%d, amp。 } 習(xí)題參考答案1.編寫程序,輸入兩個整數(shù) num1 和 num2,計算并輸出它們的和、差、積、商與余數(shù)。 i++) 24 product = product * i。 for(i = 1。 double product。 return 0。 s = fact(n)/(fact(m) * fact(nm))。m, amp。 double s。mCn=解答:!(n!)!include double fact(int n)。編寫程序,輸入 2 個正整數(shù) m 和 n(m≤n),計算并輸出組合數(shù)。 return product。i = n。 product = 1。 } double fact(int n) { int i。 printf(%d! = %.0f\n, i, myfact)。 i = n。n)。 double fact(int n)。解答:include int main(void) 23 { int i, n。 } 219 輸入一個正整數(shù) n,生成一張階乘表,輸出 1!到 n!的值。 printf(pow(3,%d) = %.0f\n, i, mypow)。 i = n。n)。 double mypow。218 輸入一個正整數(shù) n,生成一張 3 的乘方表,輸出 30到 3n的值,可以調(diào)用冪函數(shù)計算 3的乘方。 sum = sum + i。 i = 10。 } 217 執(zhí)行下列程序段后,sum 的值是 。 printf(%d! + %d! = %.0f\n, m, n, fm+fn)。 i = n。 fn = 1。 i = m。 fm = 1。m, amp。 double fm, fn。 } 216 編寫程序,輸入兩個正整數(shù) m 和 n,計算 m! + n!。 } printf(sum = %.3f\n, sum)。 flag = flag。 i++){ item = flag * / denominator。 for(i = 1。 flag = 1。n)。 double item, sum。 } 215 編寫程序,輸入一個正整數(shù) n,計算1 + 1 11 +11+ ..... 的前 n 項之和。 printf(sum = %.6f\n, sum)。 i = n。 sum = 0。 scanf(%d, amp。3 5解答:include int main(void) { int i, n。21 } return 0。 229。 i++) sum = sum + / i。 for(i = 1。n)。 double sum。 } return 0。 fahr = fahr + 2){ celsius = 5 * (fahr )/9 。 for(fahr = lower。upper)。 scanf(%d%d, amp。解答:include int main(void) {
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1