1234567891011121314151617181920212223242526 |
- #pragma once
- #include<iostream>
- //用于输出数组的函数声明
- void OutPut(int* arr/*I*/, int Arraylength/*I*/);
- //用于输入数组长度的函数声明
- void InPutArrayLength(int *Arraylength/*O*/);
- //05/23/2024 Li SiHan Added Start
- //用于遍历数组并输出的模板函数声明及函数体
- template<typename ObjectTraversed>
- void foreach(ObjectTraversed obj, int Arraylength)
- {
- for (int i = 0; i < Arraylength; i++)
- {
- if (*obj < 10)
- {
- std::cout << " " << *obj << " ";
- }
- else
- {
- std::cout << *obj << " ";
- }
- obj += 1;
- }
- }
- //05/23/2024 Li SiHan Added End
|