From 2c9056a23e1a55fd21a8e314c903d9325bffd62e Mon Sep 17 00:00:00 2001 From: Carlos Maiolino Date: Sat, 6 Sep 2025 09:37:14 +0200 Subject: Move CPP code here Signed-off-by: Carlos Maiolino --- CPP/cpp_book/chap1/1_2.cpp~ | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 CPP/cpp_book/chap1/1_2.cpp~ (limited to 'CPP/cpp_book/chap1/1_2.cpp~') diff --git a/CPP/cpp_book/chap1/1_2.cpp~ b/CPP/cpp_book/chap1/1_2.cpp~ new file mode 100644 index 0000000..9e42110 --- /dev/null +++ b/CPP/cpp_book/chap1/1_2.cpp~ @@ -0,0 +1,29 @@ +#include +#include + +int +main() +{ + std::cout << "Enter your first name: "; + std::string name; + std::cin >> name; + + const std::string greeting = "Hello, " + name + "!"; + + const std::string spaces(greeting.size(), ' '); + const std::string second = "* " + spaces + " *"; + const std::string first(second.size(), '*'); + + const std::string exclam = "!"; + const std::string msg = "Hello" + ", world" + exclam; + + std::cout << msg << std::endl; + + std::cout << std::endl; // Flush stdou buffer + + std::cout << first << std::endl; + std::cout << second << std::endl; + std::cout <<"* " + greeting + " *" << std::endl; + std::cout << second << std::endl; + std::cout << first << std::endl; +} -- cgit v1.2.3