12345678910111213141516171819202122232425262728 |
- #pragma once
- #include<iostream>
- #ifndef IO_H
- #define IO_H
- 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
- #endif
|