Professional Documents
Culture Documents
2022計算機概論期末考 上機
2022計算機概論期末考 上機
計算機概論期末考上機考題(60%期末考分數) 2022/12/21
Input a seed
123
41 54 76 5 64
66 50 79 61 65
30 51 81 64 30
87 59 96 68 31
60 35 4 67 84
41 is a prime number in 1th row 1th column
5 is a prime number in 1th row 4th column
79 is a prime number in 2th row 3th column
61 is a prime number in 2th row 4th column
59 is a prime number in 4th row 2th column
31 is a prime number in 4th row 5th column
67 is a prime number in 5th row 4th column
2. (30%) 有一個檔案名稱為 record.txt,記錄高雄港外 10 天的波浪資料,檔案內
含波浪高度(單位 meter)與方向(共有八個方位:N, NE, E, ES, S, SW, W,
WN),檔案內每一筆資料依序儲存某一天的波浪高度與方向。請撰寫 C 程式讀
取該檔案,依照波浪高度大小,從大到小寫入另一個新的檔案,其輸出型態參考
下列文件,檔案名稱定為 result.txt,並計算波浪資料之平均波高、中位數(取中
間兩個數值)、與樣本標準差(除以樣本數減 1),寫入輸出檔案的最下端。
record.txt result.txt
6.23 S 8.12, ES
8.12 ES 7.41, SW
4.77 SW 6.23, S
2.43 E 5.69, W
3.54 SW 4.77, SW
4.23 NE 4.33, WN
1.21 W 4.23, NE
4.33 WN 3.54, SW
7.41 SW 2.43, E
5.69 W 1.21, W
The average of wave height is: 4.796
The median of wave height is: 4.550
The standard deviation of wave height is: 2.142