123456789101112131415161718192021222324252627282930313233 |
- #include"io.h"
- #include<stdio.h>
- #include <assert.h>
- void OutPut(int* arr, int Arraylength)
- {
- for (int i = 0; i < Arraylength; i++)
- {
- if(arr[i]<10)
- {
- printf(" %d ", arr[i]);
- }
- else
- {
- printf("%d ", arr[i]);
- }
- }
- printf("\n");
-
- }
- void InPutArrayLength(int* Arraylength)
- {
- printf("%s","请输入您想要获得的随机数组长度:\n");
- // 05/21/2024 Li SiHan Added Start
- //函数assert用于确认数组长度输入的合法性
- //确认输入为数字
- assert(scanf_s("%d",Arraylength)!=0);
- //确认输入为正数
- assert(*Arraylength >= 0);
- // 05/21/2024 Li SiHan Added End
- }
|