You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
1.2 KiB

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/05 08:14:45 by narnaud #+# #+# */
/* Updated: 2022/09/05 08:43:03 by narnaud ### ########.fr */
/* */
/* ************************************************************************** */
#include <iostream>
#include "iter.hpp"
template <class T>
void put_t(T t) {
std::cout << t << std::endl;
}
template <class T>
void put_square(T t) {
put_t(t * t);
}
int main(void) {
int nbrs[5] = {1, 2, 3 , 4, 5};
char words[5][4] = {"the", "one", "two", "get", "any"};
iter(nbrs, 5, put_t);
iter(nbrs, 3, put_square);
iter(words, 5, put_t);
}