补全9月11日至13日课评:为13名学生创建请假文档,为5个班级创建总结文档

This commit is contained in:
chengzi
2026-09-13 19:34:34 +08:00
parent 167d832353
commit 21001eccf5
1322 changed files with 37510 additions and 4136 deletions

48
C++代码/未命名3.cpp Normal file
View File

@@ -0,0 +1,48 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n;
int arr[100100];
// 专门用来打印当前这个数组的元素
void print(){
for(int i = 1; i <= n; i++){
cout << arr[i] << " ";
}
cout << endl;
}
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> arr[i];
}
for(int i = 1; i <= n - 1; i++){ // 当前要交换的这个位置
int maxx = arr[i];
int idx = i;
for(int j = i + 1; j <= n; j++){ // j表示要和maxx进行比较的那个值的下标
// 打擂台
if(arr[j] > maxx){
maxx = arr[j];
idx = j;
}
}
swap(arr[i], arr[idx]);
cout << "第" << i << "趟:" ;
print();
}
print();
// 原数组 5 3 8 1 4
// 第一趟 8 3 5 1 4
// 第二趟 8 5 3 1 4
// 第三趟 8 5 4 1 3
// 第四趟 8 5 4 3 1
return 0;
}