cpp07/ex01/Main.cpp

27 lines
483 B
C++

#include "Iter.hpp"
void print(std::string &str)
{
std::cout << str << std::endl;
}
void afficherConst(const int &nb)
{
std::cout << nb << std::endl;
}
void add_one(int nb)
{
std::cout << nb+1 << std::endl;
}
int main()
{
std::string tab[] = {"Hello", ", ", "World ", "!"};
iter(tab, 4, print);
std::cout << std::endl;
int tab2[] = {1, 2, 3, 41};
iter(tab2, 4, add_one);
std::cout << std::endl;
iter(tab2, 4, afficherConst);
return 0;
}