Add files via upload
This commit is contained in:
+11
-2
@@ -7,7 +7,16 @@
|
||||
#ifndef MATH_UTILS_H
|
||||
#define MATH_UTILS_H
|
||||
|
||||
// 数学计算函数
|
||||
float calculateAverage(float scores[], int count); // 计算平均值
|
||||
/**
|
||||
* @brief 计算平均值
|
||||
* @details 计算浮点数数组的算术平均值
|
||||
* 遍历数组求和,然后除以元素个数
|
||||
* @param scores 浮点数数组
|
||||
* @param count 数组元素个数
|
||||
* @return 返回数组的平均值,如果count为0返回0.0
|
||||
* @note 如果count为0,函数返回0.0避免除零错误
|
||||
* @warning 如果scores为NULL且count>0,可能导致程序崩溃
|
||||
*/
|
||||
float calculateAverage(float scores[], int count);
|
||||
|
||||
#endif // MATH_UTILS_H
|
||||
Reference in New Issue
Block a user