作業-進階
大一程設
東華大學
東華大學資管系
基本程式概念
資管經驗分享
請寫一程式,該程式可以重覆執行加法、減法、乘法、除法、計算平方根、計算次方(如2的3次方)、以及可以讓使用者輸入最多10個數字後計算這些數字的平均值與標準差,輸入10個數字過程中若輸入負數代表輸入結束,則以目前已輸入數字計算平均值與標準差。程式一開始讓使用者選擇要執行哪種計算,上述七種計算的代號分別為1、2、3、4、5、6、7,若使用者輸入8代表程式結束,若輸入其他值則會回覆一錯誤訊息後繼續讓使用者輸入。在使用者選擇某一種計算後,則讓使用者輸入所需要的參數,計算出結果並顯示於螢幕上,然後再重新讓使用者選擇要執行哪種計算。
標準差公式自己查哦
有人提問 : 母體標準差跟樣本標準差公式要用哪個?
都可以,都會算對。
母體標準差公式結果為 2.87228
樣本標準差公式結果為 3.02765
Orange
Please write a program that can repeatedly perform addition, subtraction, multiplication, division, calculating the square root, and calculating the power (e.g., 2 to the 3rd power). It also allows the user to enter up to 10 numbers and calculate these numbers' average and standard deviation. If a negative number is entered during the 10-number entry process, the entry is terminated, and the program calculates the mean and standard deviation from the currently entered numbers. At the beginning of the program, the user can choose which calculation to perform by entering a code. The codes for the above seven calculations are 1, 2, 3, 4, 5, 6, 7, and if the user enters 8, the program ends. If the user enters other values, the program shows an error message, and the user will continue to enter. After selecting one of the calculations, the user should enter the required parameters. Then the program calculates the results and displays the results on the screen. The user can select which calculation to perform again.