1.数组升序
#include<iostream>
using namespace std;
//冒泡排序
void bubbleSort(int* arr, int len) {
for (int i = 0; i < len - 1; i++) {
for (int j = 0; j < len - 1-i; j++) {
if (arr[j] > arr[j + 1]) {
int tmp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = tmp;
}
}
}
}
//打印输出
void printArray(int* arr, int len) {
for (int i = 0; i < len ; i++) {
cout << arr[i] <<" ";
}
cout << "\b" << endl;
}
int main() {
int arr[10] = { 4,3,6,9,1,2,10,8,7,5 };
int len = sizeof(arr) / sizeof(arr[0]);
printArray(arr, len);
bubbleSort(arr, len);
printArray(arr, len);
system("pause");
return 0;
}

2.打印分数
#include<iostream>
#include<stdio.h>
#include<string>
#include<ctime>
using namespace std;
//Student必须写在Teacher前面
struct Student {
string sName;
int score;
};
struct Teacher {
string tName;
struct Student sArray[5];
};
//分配内容
void allocateSpace(struct Teacher tArray[], int len) {
string nameSeed = "ABCDE";
for (int i = 0; i < len; i++) {
tArr