unit test

This commit is contained in:
Yaossg 2024-12-07 14:13:34 +08:00
parent 98d5a1a3bc
commit 54db58d362
18 changed files with 64 additions and 9 deletions

28
test/sort.c Normal file
View file

@ -0,0 +1,28 @@
int printf(char* format, ...);
int scanf(char* format, ...);
void sort(int a[], int n) {
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (a[i] > a[j]) {
int t = a[i];
a[i] = a[j];
a[j] = t;
}
}
}
}
int main() {
int n;
int a[100];
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
sort(a, n);
for (int i = 0; i < n; i++) {
printf("%d ", a[i]);
}
printf("\n");
}