Improved std::cout

This commit is contained in:
2025-09-29 07:13:10 +02:00
parent f9212563e4
commit 934df9fc03

View File

@@ -6,7 +6,7 @@
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */ /* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/06 01:58:01 by aortigos #+# #+# */ /* Created: 2025/09/06 01:58:01 by aortigos #+# #+# */
/* Updated: 2025/09/14 13:49:52 by aortigos ### ########.fr */ /* Updated: 2025/09/29 07:12:22 by aortigos ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -14,30 +14,28 @@
int main() int main()
{ {
std::string str = "Hola 42!"; std::string str = "HI THIS IS BRAIN";
std::string *ptr = &str; std::string *ptr = &str;
std::string &ref = str; std::string &ref = str;
// Imprimimos las direcciones de memoria // Imprimimos las direcciones de memoria
std::cout << "Imprimiendo direcciones de memoria..."; std::cout << "Printing memory addresses..." << std::endl;
std::cout << std::endl << std::endl;
std::cout << &str << std::endl; std::cout << "Str memory address: " << &str << std::endl;
std::cout << ptr << std::endl; std::cout << "Ptr memory address: " << ptr << std::endl;
std::cout << &ref << std::endl; std::cout << "Ref memory address: " << &ref << std::endl;
std::cout << std::endl << std::endl; std::cout << std::endl;
// Imprimimos los valores // Imprimimos los valores
std::cout << "Imprimiendo los valores de las variables..."; std::cout << "Printing values..." << std::endl;
std::cout << std::endl << std::endl;
std::cout << str << std::endl; std::cout << "Str value: " << str << std::endl;
std::cout << *ptr << std::endl; std::cout << "Ptr value: " << *ptr << std::endl;
std::cout << ref << std::endl; std::cout << "Ref value: " << ref << std::endl;
return (0); return (0);
} }