#include using namespace std; int main() { int a[5] = {0}; for (int i = 0; i < 5; ++i) { cin >> a[i]; } const int len = sizeof a / sizeof a[0]; //--²åÈëÅÅÐò£¨ÉýÐò£©---------------- for (int i = 1; i < len; i++) { int key = a[i]; int j = i - 1; while (j >= 0 && key < a[j]) { a[j + 1] = a[j]; j--; } a[j + 1] = key; } //--------------------------------- cout << "ÉýÐò£º"; for (int i = 0; i < len; i++) { cout << a[i] << " "; } cout << endl; //--²åÈëÅÅÐò£¨½µÐò£©---------------- for (int i = 1; i < len; i++) { int key = a[i]; int j = i - 1; while (j >= 0 && key > a[j]) { a[j + 1] = a[j]; j--; } a[j + 1] = key; } //--------------------------------- cout << "½µÐò£º"; for (int i = 0; i < len; i++) { cout << a[i] << " "; } cout << endl; return 0; }