main.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*HEAD lisihan_homework/随机数排序/main.c */
  2. /*==============================================================================
  3. 2024年度面向对象程序设计作业
  4. ================================================================================
  5. File description:
  6. 这是随机数排序的程序。
  7. 提交者:李思翰
  8. 邮 箱:1711871773@qq.com
  9. ================================================================================
  10. Date Name Description of Change
  11. 05/19/2024 Li SiHan Created
  12. 05/21/2024 Li SiHan Added Code comments and Assert function
  13. 05/23/2024 Li SiHan Change C to C++ and Added OutPut Template function and Code comments
  14. 05/27/2024 Li SiHan Added Code comments and dll
  15. $HISTORY$
  16. ================================================================================
  17. */
  18. #include<stdio.h>
  19. #include"algo.h"
  20. #include"io.h"
  21. //05/27/2024 Li SiHan Added Start
  22. //动态链接库的头文件引用
  23. #include"GenerateMethod.h"
  24. //05/27/2024 Li SiHan Added End
  25. int main()
  26. {
  27. //对于数组的长度这一变量进行声明及初始化
  28. int Arraylength=0;
  29. //用户对数组长度这一变量进行赋值
  30. InPutArrayLength(&Arraylength);
  31. //05/27/2024 Li SiHan Added Start
  32. //用动态链接库的方法生成并返回所需长度的随机数组
  33. int* arr = RandomArrayCreate(Arraylength);
  34. //05/27/2024 Li SiHan Added End
  35. //输出当前所生成的数组
  36. OutPut(arr,Arraylength);
  37. //对数组进行快速排序
  38. QuickSort(arr,0, Arraylength-1);
  39. //05/23/2024 Li SiHan Added Start
  40. //用模板函数输出排序后的数组
  41. foreach(arr,Arraylength);
  42. //05/23/2024 Li SiHan Added End
  43. return 0;
  44. }