diff options
| author | Carlos Maiolino <[email protected]> | 2025-09-06 09:37:14 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2025-09-06 09:37:14 +0200 |
| commit | 2c9056a23e1a55fd21a8e314c903d9325bffd62e (patch) | |
| tree | a73ba1c7bb60dd89c9e70769dd510e59a49a56a1 /CPP/cpp_book/chap1 | |
| parent | ee8a08bfa24d9a3d09273fdebe8d73ac38c545f9 (diff) | |
Move CPP code here
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'CPP/cpp_book/chap1')
| -rwxr-xr-x | CPP/cpp_book/chap1/1_1 | bin | 0 -> 16544 bytes | |||
| -rw-r--r-- | CPP/cpp_book/chap1/1_1.cpp | 15 | ||||
| -rw-r--r-- | CPP/cpp_book/chap1/1_1.cpp~ | 15 | ||||
| -rwxr-xr-x | CPP/cpp_book/chap1/1_2 | bin | 0 -> 50624 bytes | |||
| -rw-r--r-- | CPP/cpp_book/chap1/1_2.cpp | 26 | ||||
| -rw-r--r-- | CPP/cpp_book/chap1/1_2.cpp~ | 29 | ||||
| -rw-r--r-- | CPP/cpp_book/chap1/exe.cpp | 23 |
7 files changed, 108 insertions, 0 deletions
diff --git a/CPP/cpp_book/chap1/1_1 b/CPP/cpp_book/chap1/1_1 Binary files differnew file mode 100755 index 0000000..1d73f5e --- /dev/null +++ b/CPP/cpp_book/chap1/1_1 diff --git a/CPP/cpp_book/chap1/1_1.cpp b/CPP/cpp_book/chap1/1_1.cpp new file mode 100644 index 0000000..7a6cd2c --- /dev/null +++ b/CPP/cpp_book/chap1/1_1.cpp @@ -0,0 +1,15 @@ +#include <iostream> +#include <string> + +int +main() +{ + std::cout << "Please enter your first name: "; + + std::string name; + std::cin >> name; + + std::cout << "Hello, " << name << ". Welcome!" << std::endl; + + return 0; +} diff --git a/CPP/cpp_book/chap1/1_1.cpp~ b/CPP/cpp_book/chap1/1_1.cpp~ new file mode 100644 index 0000000..c7cc953 --- /dev/null +++ b/CPP/cpp_book/chap1/1_1.cpp~ @@ -0,0 +1,15 @@ +#include <iostream> +#include <string> + +int +main() +{ + std::cout << "Please enter your first name: "; + + std::string name; + std::in >> name; + + std::cout << "Hello, " << name << ". Welcome!" << std::endl; + + return 0; +} diff --git a/CPP/cpp_book/chap1/1_2 b/CPP/cpp_book/chap1/1_2 Binary files differnew file mode 100755 index 0000000..05ac539 --- /dev/null +++ b/CPP/cpp_book/chap1/1_2 diff --git a/CPP/cpp_book/chap1/1_2.cpp b/CPP/cpp_book/chap1/1_2.cpp new file mode 100644 index 0000000..b914271 --- /dev/null +++ b/CPP/cpp_book/chap1/1_2.cpp @@ -0,0 +1,26 @@ +#include <iostream> +#include <string> + +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(), '*'); + + 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; +} 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 <iostream> +#include <string> + +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; +} diff --git a/CPP/cpp_book/chap1/exe.cpp b/CPP/cpp_book/chap1/exe.cpp new file mode 100644 index 0000000..537d955 --- /dev/null +++ b/CPP/cpp_book/chap1/exe.cpp @@ -0,0 +1,23 @@ +#include <iostream> +#include <string> + +int main(void) { + + std::cout << "Whats us your name? "; + std::string name; + + std::cin >> name; + + std::cout << "Hello, " << name + << std::endl + << "And what is yours? "; + + std::cin >> name; + + std::cout << "Hello, " << name + << "; nice to meet you too!" + << std::endl; + + + return 0; +} |
