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