-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
44 lines (39 loc) · 1.38 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jmartin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/08 15:24:21 by jmartin #+# #+# */
/* Updated: 2022/11/08 15:24:21 by jmartin ### ########.fr */
/* */
/* ************************************************************************** */
#include "iter.hpp"
#include <string>
void print(int const &i)
{
std::cout << i << std::endl;
}
void toUpper(std::string const &str)
{
for (size_t i = 0; i < str.length(); i++)
{
if (str[i] >= 'a' && str[i] <= 'z')
std::cout << (char)(str[i] - 32);
else
std::cout << str[i];
}
}
int main(void)
{
{
int array[5] = {1, 2, 3, 4, 5};
::iter<int>(array, 5, print);
}
{
std::string array[5] = {"hello ", "world ", "this ", "is ", "a test"};
::iter<std::string>(array, 5, toUpper);
}
return (0);
}