#include <iostream> using namespace std; #include <bits/stdc++.h> #define max 7 //冒泡排序,升序 void sort(int arr[], int length) { for (int i = 0; i < length - 1; i++) { for (int j = 0; j < length - i - 1; j++) { if (arr[j] > arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } } int main() { int arr[max] = { 0 }; //定义数组记录成绩 while (cin >> arr[0] >> arr[1] >> arr[2] >> arr[3] >> arr[4] >> arr[5] >> arr[6]) { sort(arr, max); //升序排序 cout << fixed << setprecision(2) << (arr[1] + arr[2] + arr[3] + arr[4] + arr[5]) / 5.0 << endl; } system("pause"); return 0; }