鐵之狂傲

 取回密碼
 註冊
搜尋

一般的騎士

菜鳥騎士

切換到指定樓層
1#
10鐵幣
題目...http://www.math.nuk.edu.tw/jinnliu/teaching/cs08s/C++%20Project%203.htm
這是我們程式設計的作業,老實說...我完全看不懂XD.
請高手解釋一下,如果能做個範例會更好,感覺看範例比較好懂.感謝您的協助
PS.作業禮拜一要交orz||

最佳解答

PoorCat0919 檢視完整內容

/* print a message explaining what the program does: */print_preliminary_message(); printf("This program prints out a conversion table of temperatures.\n"); /* prompt the user for table specifications in Fahrenheit: */input_table_specifications(lower, upper, step); printf("Enter the minimum (whole number) temperature\n"); printf("you want in the table, in Fahrenheit: ");scanf("%d", &lower); printf ...
 
一擊脫離MOD!!
轉播0 分享0 收藏0

回覆 使用道具 檢舉

/* print a message explaining what the program does: */print_preliminary_message();
printf("This program prints out a conversion table of temperatures.\n");
/* prompt the user for table specifications in Fahrenheit: */input_table_specifications(lower, upper, step);
printf("Enter the minimum (whole number) temperature\n");
printf("you want in the table, in Fahrenheit: ");scanf("%d", &lower);
printf("Enter the maximum temperature you want in the table: ");  
scanf("%d", &upper);
printf("Enter the temperature difference you want between table entries:");scanf("%d", &step);
/* print appropriate message including an echo of the input: */print_message_echoing_input(lower, upper, step);
printf("Tempertature conversion table from %d Fahrenheit\n", lower);
printf("to %d Fahrenheit, in steps of %d Fahrenheit:", upper, step);
/* Print the table (including the column headings): */print_table(lower, upper, step);
printf("Fahrenheit/tCelsius/tAbsolute Value/n");
double abs, cel;
for(int i = lower; i <= upper; i += step) {        
cel = celsius_of(i);        
abs = absolute_value_of(i);        
printf("%d\t%f\t%f\n", i, cel, abs);
}
大體的程式如此,接下來只要拆成Header(*.h)跟主程式檔就可以了在呼叫函式時要注意形式上的問題,因為主程式定義lower, upper, step為值的方式而題目定義呼叫的方式為傳值的方式,因此如要符合題目之函式呼叫方式,定義時要注意一下

[ 本文最後由 PoorCat0919 於 08-5-4 08:36 AM 編輯 ]
 
No more thinking, just follow your feeling to dance your hand

回覆 使用道具 檢舉

不知道你是看不懂題目問什麼,還是知道題目的意思但不會做?

如果是看不懂題目的話,或許還可以幫上一點忙
如果是知道題目但不會做的話,就只能請你自行參考課本了
(我也是懶得寫作業的人...)
 

回覆 使用道具 檢舉

一般的騎士

菜鳥騎士

原文由 keinxxxx 於 08-4-26 04:06 PM 發表 [原文]
不知道你是看不懂題目問什麼,還是知道題目的意思但不會做?

如果是看不懂題目的話,或許還可以幫上一點忙
如果是知道題目但不會做的話,就只能請你自行參考課本了
(我也是懶得寫作業的人...) ...

如果能解釋一下題目意思也OK
,現在完完全全是0的狀態..有任何的提示都是十分有幫助的
總之麻煩您了^^a
 

回覆 使用道具 檢舉

這是一個華氏溫度轉換成攝氏和絕對溫度的程式
執行的結果請參考程式下面的 Example output:
------------------------------------------------------------------------------------------------------------------------
Q1.補齊這個程式欠缺的4個函式的定義
print_preliminary_message:顯示訊息給使用者
input_table_specifications:取得華氏溫度的最低值、最高值、溫度間隔
print_message_echoing_input:顯示使用者輸入的最低值、最高值、溫度間隔
print_table:輸出結果
------------------------------------------------------------------------------------------------------------------------
Q2.把程式分成3個檔案
1.主程式
2.標頭檔,內含 celsius_of、absolute_value_of 這2個函式
celsius_of:華氏轉換成攝氏
absolute_value_of:華氏轉換成絕對溫度
3.經過上面2個函式轉換後的結果
------------------------------------------------------------------------------------------------------------------------
沒錯的話大概就是這樣,剩下的自己努力吧
 

回覆 使用道具 檢舉

一般的騎士

菜鳥騎士

原文由 keinxxxx 於 08-4-27 12:53 AM 發表 [原文]
這是一個華氏溫度轉換成攝氏和絕對溫度的程式
執行的結果請參考程式下面的 Example output:
------------------------------------------------------------------------------------------------------------------ ...

補齊的意思是要補上
/* FUNCTION TO CONVERT FAHRENHEIT TO CELSIUS */

double celsius_of(int fahr)
{
return (static_cast<double>(5)/9) * (fahr - 32);
}
/* END OF FUNCTION */
類似這種東西嗎?
 

回覆 使用道具 檢舉

你需要登入後才可以回覆 登入 | 註冊

存檔|手機版|聯絡我們|新聞提供|鐵之狂傲

GMT+8, 24-10-1 12:48 , Processed in 1.133250 second(s), 16 queries , Gzip On.

回頂部