Files
cpp07/ex02/main.cpp
Angel Ortigosa Perez 317ecbc1f9 ex02 fixed
2026-04-08 20:51:29 +02:00

52 lines
1.7 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/04/08 20:40:27 by aortigos #+# #+# */
/* Updated: 2026/04/08 20:50:41 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "Array/Array.hpp"
int main(int, char**)
{
Array<int> nb(6);
nb[0] = 0;
nb[1] = 1;
nb[2] = 2;
nb[3] = 3;
std::cout << "Imprimiendo array de ints..." << std::endl;
try {
std::cout << "Posicion X: " << nb[5] << std::endl;
} catch(std::exception &e)
{
std::cout << e.what() << std::endl;
}
std::cout << "Tamaño: " << nb.size() << std::endl;
Array<std::string> st(6);
st[0] = "as2";
st[1] = "wa1";
st[2] = "lf2";
st[3] = "as3";
st[4] = "xs4";
st[5] = "aj5";
std::cout << std::endl << "Imprimiendo array de strs..." << std::endl;
try {
std::cout << "Posicion X: " << st[4] << std::endl;
} catch(std::exception &e)
{
std::cout << e.what() << std::endl;
}
std::cout << "Tamaño: " << st.size() << std::endl;
}