|
@@ -0,0 +1,57 @@
|
|
|
+/*HEAD lisihan_homework/随机数排序/main.c */
|
|
|
+ /*==============================================================================
|
|
|
+ 2024年度面向对象程序设计作业
|
|
|
+================================================================================
|
|
|
+ File description:
|
|
|
+
|
|
|
+ 这是随机数排序的程序。
|
|
|
+ 提交者:李思翰
|
|
|
+ 邮 箱:1711871773@qq.com
|
|
|
+
|
|
|
+ ================================================================================
|
|
|
+ Date Name Description of Change
|
|
|
+ 05/19/2024 Li SiHan Created
|
|
|
+ 05/21/2024 Li SiHan Added Code comments and Assert function
|
|
|
+ 05/23/2024 Li SiHan Change C to C++ and Added OutPut Template function and Code comments
|
|
|
+ 05/27/2024 Li SiHan Added Code comments and dll
|
|
|
+ $HISTORY$
|
|
|
+ ================================================================================
|
|
|
+ */
|
|
|
+#include<stdio.h>
|
|
|
+#include"algo.h"
|
|
|
+#include"io.h"
|
|
|
+//05/27/2024 Li SiHan Added Start
|
|
|
+//动态链接库的头文件引用
|
|
|
+#include"GenerateMethod.h"
|
|
|
+//05/27/2024 Li SiHan Added End
|
|
|
+int main()
|
|
|
+{
|
|
|
+ //对于数组的长度这一变量进行声明及初始化
|
|
|
+ int Arraylength=0;
|
|
|
+
|
|
|
+ //用户对数组长度这一变量进行赋值
|
|
|
+ InPutArrayLength(&Arraylength);
|
|
|
+
|
|
|
+ //05/27/2024 Li SiHan Added Start
|
|
|
+ //用动态链接库的方法生成并返回所需长度的随机数组
|
|
|
+ int* arr = RandomArrayCreate(Arraylength);
|
|
|
+ //05/27/2024 Li SiHan Added End
|
|
|
+
|
|
|
+ //输出当前所生成的数组
|
|
|
+ OutPut(arr,Arraylength);
|
|
|
+
|
|
|
+ //对数组进行快速排序
|
|
|
+ QuickSort(arr,0, Arraylength-1);
|
|
|
+
|
|
|
+ //05/23/2024 Li SiHan Added Start
|
|
|
+ //用模板函数输出排序后的数组
|
|
|
+ foreach(arr,Arraylength);
|
|
|
+ //05/23/2024 Li SiHan Added End
|
|
|
+
|
|
|
+ return 0;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|