作業-進階
大一程設
東華大學
東華大學資管系
基本程式概念
資管經驗分享
請寫一程式,其最多可記錄5人的身高與體重。程式透過Input這個function讓使用者輸入最多5人的身高與體重,若輸入的身高與體重有任一個小於或等於0也代表輸入結束。在Calculation這個function中計算每個人的BMI值,最後在Show這個function中輸出最高與最低的BMI值。請以一個二維矩陣(2-d array)記錄每個人的身高與體重,以一個一維矩陣記錄所有BMI值。假設身高的輸入值皆為公尺,體重的輸入值皆為公斤。
Please write a program that can record the height and weight of up to 5 people. The program uses the function Input to allow the user to enter the height and weight of up to 5 people. The input finishes if any entered height and weight is less than or equal to 0. The BMI of each person is calculated in the Calculation function, and the highest BMI and lowest BMI are finally output in the Show function. The main function calls these three functions in turn. Please record everyone’s height and weight as a 2-d array and all BMI as a 1-d array. The input values for height are assumed to be in meters, and the input values for weight are in kilograms.