From 58c31958319e29b8a913a3886108e2b49dc66a13 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Mon, 24 Mar 2025 21:52:52 +0100 Subject: [PATCH] Join strings and newline char (#8394) --- .../cpp/content/c-vs-c@2Ag0t3LPryTF8khHLRfy-.md | 2 +- .../cpp/content/compilers@FTMHsUiE8isD_OVZr62Xc.md | 2 +- .../content/containers@1pydf-SR0QUfVNuBEyvzc.md | 4 ++-- .../content/copy-on-write@O2Du5gHHxFxAI2u5uO8wu.md | 4 ++-- .../cpp/content/crtp@ttt-yeIi4BPWrgvW324W7.md | 4 ++-- .../diamond-inheritance@ofwdZm05AUqCIWmfgGHk8.md | 8 ++++---- .../dynamic-polymorphism@7h1VivjCPDwriL7FirtFv.md | 6 +++--- .../content/dynamic_cast@4BdFcuQ5KNW94cu2jz-vE.md | 4 ++-- .../content/exit-codes@oWygnpwHq2poXQMTTSCpl.md | 6 +++--- ...emplate-specialization@6hTcmJwNnQstbWWzNCfTe.md | 4 ++-- .../headers--cpp-files@CK7yf8Bo7kfbV6x2tZTrh.md | 2 +- .../cpp/content/iostream@VeVxZ230xkesQsIDig8zQ.md | 4 ++-- .../cpp/content/lambdas@xjiFBVe-VGqCqWfkPVGKf.md | 2 +- .../logical-operators@Y9gq8WkDA_XGe68JkY2UZ.md | 8 ++++---- .../multiple-inheritance@WjHpueZDK-d3oDNMVZi9w.md | 6 +++--- .../multithreading@OXQUPqxzs1-giAACwl3X1.md | 2 +- ...t-oriented-programming@b3-QYKNcW3LYCNOza3Olf.md | 14 +++++++------- .../cpp/content/pimpl@MEoWt8NKjPLVTeGgYf3cR.md | 2 +- ...ing-your-first-program@SEq0D2Zg5WTsIDtd1hW9f.md | 4 ++-- ...ng-up-your-environment@Zc_TTzmM36yWsu3GvOy9x.md | 2 +- .../cpp/content/sfinae@3C5UfejDX-1Z8ZF6C53xD.md | 4 ++-- 21 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/data/roadmaps/cpp/content/c-vs-c@2Ag0t3LPryTF8khHLRfy-.md b/src/data/roadmaps/cpp/content/c-vs-c@2Ag0t3LPryTF8khHLRfy-.md index 9c119abae..737776649 100644 --- a/src/data/roadmaps/cpp/content/c-vs-c@2Ag0t3LPryTF8khHLRfy-.md +++ b/src/data/roadmaps/cpp/content/c-vs-c@2Ag0t3LPryTF8khHLRfy-.md @@ -34,7 +34,7 @@ int main() { class HelloWorld { public: void printHello() { - std::cout << "Hello, World!" << '\n'; + std::cout << "Hello, World!\n"; } }; diff --git a/src/data/roadmaps/cpp/content/compilers@FTMHsUiE8isD_OVZr62Xc.md b/src/data/roadmaps/cpp/content/compilers@FTMHsUiE8isD_OVZr62Xc.md index 89f5b34f9..8a9245980 100644 --- a/src/data/roadmaps/cpp/content/compilers@FTMHsUiE8isD_OVZr62Xc.md +++ b/src/data/roadmaps/cpp/content/compilers@FTMHsUiE8isD_OVZr62Xc.md @@ -22,7 +22,7 @@ Let's say you have a simple C++ program saved in a file called `hello.cpp`: #include int main() { - std::cout << "Hello, World!" << '\n'; + std::cout << "Hello, World!\n"; return 0; } ``` diff --git a/src/data/roadmaps/cpp/content/containers@1pydf-SR0QUfVNuBEyvzc.md b/src/data/roadmaps/cpp/content/containers@1pydf-SR0QUfVNuBEyvzc.md index bf980d8e4..8d238670f 100644 --- a/src/data/roadmaps/cpp/content/containers@1pydf-SR0QUfVNuBEyvzc.md +++ b/src/data/roadmaps/cpp/content/containers@1pydf-SR0QUfVNuBEyvzc.md @@ -64,7 +64,7 @@ int main() { m["one"] = 1; m["two"] = 2; - std::cout << "Map contains:" << '\n'; + std::cout << "Map contains:\n"; for (const auto &pair : m) { std::cout << pair.first << ": " << pair.second << '\n'; } @@ -87,7 +87,7 @@ int main() { um["one"] = 1; um["two"] = 2; - std::cout << "Unordered map contains:" << '\n'; + std::cout << "Unordered map contains:\n"; for (const auto &pair : um) { std::cout << pair.first << ": " << pair.second << '\n'; } diff --git a/src/data/roadmaps/cpp/content/copy-on-write@O2Du5gHHxFxAI2u5uO8wu.md b/src/data/roadmaps/cpp/content/copy-on-write@O2Du5gHHxFxAI2u5uO8wu.md index 39ead88f0..4c509ca77 100644 --- a/src/data/roadmaps/cpp/content/copy-on-write@O2Du5gHHxFxAI2u5uO8wu.md +++ b/src/data/roadmaps/cpp/content/copy-on-write@O2Du5gHHxFxAI2u5uO8wu.md @@ -14,7 +14,7 @@ public: // Use the same shared data for copying. MyString(const MyString &other) : data(other.data) { - std::cout << "Copied using the Copy-Write idiom." << '\n'; + std::cout << "Copied using the Copy-Write idiom.\n"; } // Make a copy only if we want to modify the data. @@ -22,7 +22,7 @@ public: // Check if there's more than one reference. if (data.use_count() > 1) { data = std::make_shared(*data); - std::cout << "Copy is actually made for writing." << '\n'; + std::cout << "Copy is actually made for writing.\n"; } *data = str; } diff --git a/src/data/roadmaps/cpp/content/crtp@ttt-yeIi4BPWrgvW324W7.md b/src/data/roadmaps/cpp/content/crtp@ttt-yeIi4BPWrgvW324W7.md index 52d19eb73..a573e565d 100644 --- a/src/data/roadmaps/cpp/content/crtp@ttt-yeIi4BPWrgvW324W7.md +++ b/src/data/roadmaps/cpp/content/crtp@ttt-yeIi4BPWrgvW324W7.md @@ -17,14 +17,14 @@ public: } void implementation() { - std::cout << "Default implementation in Base" << '\n'; + std::cout << "Default implementation in Base\n"; } }; class Derived1 : public Base { public: void implementation() { - std::cout << "Custom implementation in Derived1" << '\n'; + std::cout << "Custom implementation in Derived1\n"; } }; diff --git a/src/data/roadmaps/cpp/content/diamond-inheritance@ofwdZm05AUqCIWmfgGHk8.md b/src/data/roadmaps/cpp/content/diamond-inheritance@ofwdZm05AUqCIWmfgGHk8.md index cc166d6bd..5ed4139f8 100644 --- a/src/data/roadmaps/cpp/content/diamond-inheritance@ofwdZm05AUqCIWmfgGHk8.md +++ b/src/data/roadmaps/cpp/content/diamond-inheritance@ofwdZm05AUqCIWmfgGHk8.md @@ -12,28 +12,28 @@ To resolve this ambiguity, you can use virtual inheritance. A virtual base class class Base { public: void print() { - std::cout << "Base class" << '\n'; + std::cout << "Base class\n"; } }; class Derived1 : virtual public Base { public: void derived1Print() { - std::cout << "Derived1 class" << '\n'; + std::cout << "Derived1 class\n"; } }; class Derived2 : virtual public Base { public: void derived2Print() { - std::cout << "Derived2 class" << '\n'; + std::cout << "Derived2 class\n"; } }; class Derived3 : public Derived1, public Derived2 { public: void derived3Print() { - std::cout << "Derived3 class" << '\n'; + std::cout << "Derived3 class\n"; } }; diff --git a/src/data/roadmaps/cpp/content/dynamic-polymorphism@7h1VivjCPDwriL7FirtFv.md b/src/data/roadmaps/cpp/content/dynamic-polymorphism@7h1VivjCPDwriL7FirtFv.md index d16395882..aa185be47 100644 --- a/src/data/roadmaps/cpp/content/dynamic-polymorphism@7h1VivjCPDwriL7FirtFv.md +++ b/src/data/roadmaps/cpp/content/dynamic-polymorphism@7h1VivjCPDwriL7FirtFv.md @@ -15,7 +15,7 @@ Here's an example in C++ demonstrating dynamic polymorphism. class Shape { public: virtual void draw() { - std::cout << "Drawing a shape" << '\n'; + std::cout << "Drawing a shape\n"; } }; @@ -23,7 +23,7 @@ public: class Circle : public Shape { public: void draw() override { - std::cout << "Drawing a circle" << '\n'; + std::cout << "Drawing a circle\n"; } }; @@ -31,7 +31,7 @@ public: class Rectangle : public Shape { public: void draw() override { - std::cout << "Drawing a rectangle" << '\n'; + std::cout << "Drawing a rectangle\n"; } }; diff --git a/src/data/roadmaps/cpp/content/dynamic_cast@4BdFcuQ5KNW94cu2jz-vE.md b/src/data/roadmaps/cpp/content/dynamic_cast@4BdFcuQ5KNW94cu2jz-vE.md index c0a83e0ce..9475d53e9 100644 --- a/src/data/roadmaps/cpp/content/dynamic_cast@4BdFcuQ5KNW94cu2jz-vE.md +++ b/src/data/roadmaps/cpp/content/dynamic_cast@4BdFcuQ5KNW94cu2jz-vE.md @@ -10,14 +10,14 @@ Here is a basic example of how `dynamic_cast` can be used: class BaseClass { public: virtual void display() { - std::cout << "BaseClass" << '\n'; + std::cout << "BaseClass\n"; } }; class DerivedClass : public BaseClass { public: void display() { - std::cout << "DerivedClass" << '\n'; + std::cout << "DerivedClass\n"; } }; diff --git a/src/data/roadmaps/cpp/content/exit-codes@oWygnpwHq2poXQMTTSCpl.md b/src/data/roadmaps/cpp/content/exit-codes@oWygnpwHq2poXQMTTSCpl.md index bdd8856a7..147225040 100644 --- a/src/data/roadmaps/cpp/content/exit-codes@oWygnpwHq2poXQMTTSCpl.md +++ b/src/data/roadmaps/cpp/content/exit-codes@oWygnpwHq2poXQMTTSCpl.md @@ -15,14 +15,14 @@ int main() { // Some code here... if (/*some error condition*/) { - std::cout << "An error occurred." << '\n'; + std::cout << "An error occurred.\n"; return 1; } // More code here... if (/*another error condition*/) { - std::cout << "Another error occurred." << '\n'; + std::cout << "Another error occurred.\n"; return 2; } @@ -40,7 +40,7 @@ void some_function() { // Some code here... if (/*some error condition*/) { - std::cout << "An error occurred." << '\n'; + std::cout << "An error occurred.\n"; std::exit(1); } diff --git a/src/data/roadmaps/cpp/content/full-template-specialization@6hTcmJwNnQstbWWzNCfTe.md b/src/data/roadmaps/cpp/content/full-template-specialization@6hTcmJwNnQstbWWzNCfTe.md index c73491db1..11a15791d 100644 --- a/src/data/roadmaps/cpp/content/full-template-specialization@6hTcmJwNnQstbWWzNCfTe.md +++ b/src/data/roadmaps/cpp/content/full-template-specialization@6hTcmJwNnQstbWWzNCfTe.md @@ -19,7 +19,7 @@ template class MyContainer { public: void print() { - std::cout << "Generic container." << '\n'; + std::cout << "Generic container.\n"; } }; @@ -28,7 +28,7 @@ template <> class MyContainer { public: void print() { - std::cout << "Container for integers." << '\n'; + std::cout << "Container for integers.\n"; } }; diff --git a/src/data/roadmaps/cpp/content/headers--cpp-files@CK7yf8Bo7kfbV6x2tZTrh.md b/src/data/roadmaps/cpp/content/headers--cpp-files@CK7yf8Bo7kfbV6x2tZTrh.md index 3625ad563..a5270117c 100644 --- a/src/data/roadmaps/cpp/content/headers--cpp-files@CK7yf8Bo7kfbV6x2tZTrh.md +++ b/src/data/roadmaps/cpp/content/headers--cpp-files@CK7yf8Bo7kfbV6x2tZTrh.md @@ -33,7 +33,7 @@ Example of a source file: #include void Example::printMessage() { - std::cout << "Hello, code splitting!" << '\n'; + std::cout << "Hello, code splitting!\n"; } ``` diff --git a/src/data/roadmaps/cpp/content/iostream@VeVxZ230xkesQsIDig8zQ.md b/src/data/roadmaps/cpp/content/iostream@VeVxZ230xkesQsIDig8zQ.md index 18ff5ab60..bb3c07e15 100644 --- a/src/data/roadmaps/cpp/content/iostream@VeVxZ230xkesQsIDig8zQ.md +++ b/src/data/roadmaps/cpp/content/iostream@VeVxZ230xkesQsIDig8zQ.md @@ -35,8 +35,8 @@ int main() { #include int main() { - std::cerr << "An error occurred." << '\n'; - std::clog << "Logging information." << '\n'; + std::cerr << "An error occurred.\n"; + std::clog << "Logging information.\n"; return 0; } ``` diff --git a/src/data/roadmaps/cpp/content/lambdas@xjiFBVe-VGqCqWfkPVGKf.md b/src/data/roadmaps/cpp/content/lambdas@xjiFBVe-VGqCqWfkPVGKf.md index 10d4a1f9b..ca5dd805b 100644 --- a/src/data/roadmaps/cpp/content/lambdas@xjiFBVe-VGqCqWfkPVGKf.md +++ b/src/data/roadmaps/cpp/content/lambdas@xjiFBVe-VGqCqWfkPVGKf.md @@ -25,7 +25,7 @@ Here are a few examples to demonstrate the use of lambda functions in C++: ```cpp auto printHello = []() { - std::cout << "Hello, World!" << '\n'; + std::cout << "Hello, World!\n"; }; printHello(); // Output: Hello, World! ``` diff --git a/src/data/roadmaps/cpp/content/logical-operators@Y9gq8WkDA_XGe68JkY2UZ.md b/src/data/roadmaps/cpp/content/logical-operators@Y9gq8WkDA_XGe68JkY2UZ.md index 14279deb4..850a04f60 100644 --- a/src/data/roadmaps/cpp/content/logical-operators@Y9gq8WkDA_XGe68JkY2UZ.md +++ b/src/data/roadmaps/cpp/content/logical-operators@Y9gq8WkDA_XGe68JkY2UZ.md @@ -13,7 +13,7 @@ C++ provides the following logical operators: ```cpp int a = 5, b = 10; if (a > 0 && b > 0) { - std::cout << "Both values are positive." << '\n'; + std::cout << "Both values are positive.\n"; } ``` - **OR Operator (||)** @@ -25,7 +25,7 @@ C++ provides the following logical operators: ```cpp int a = 5, b = -10; if (a > 0 || b > 0) { - std::cout << "At least one value is positive." << '\n'; + std::cout << "At least one value is positive.\n"; } ``` @@ -38,7 +38,7 @@ C++ provides the following logical operators: ```cpp int a = 5; if (!(a < 0)) { - std::cout << "The value is not negative." << '\n'; + std::cout << "The value is not negative.\n"; } ``` @@ -48,7 +48,7 @@ Using these operators, you can create more complex logical expressions, for exam int a = 5, b = -10, c = 15; if (a > 0 && (b > 0 || c > 0)) { - std::cout << "At least two values are positive." << '\n'; + std::cout << "At least two values are positive.\n"; } ``` diff --git a/src/data/roadmaps/cpp/content/multiple-inheritance@WjHpueZDK-d3oDNMVZi9w.md b/src/data/roadmaps/cpp/content/multiple-inheritance@WjHpueZDK-d3oDNMVZi9w.md index e617ef034..5871224b4 100644 --- a/src/data/roadmaps/cpp/content/multiple-inheritance@WjHpueZDK-d3oDNMVZi9w.md +++ b/src/data/roadmaps/cpp/content/multiple-inheritance@WjHpueZDK-d3oDNMVZi9w.md @@ -30,7 +30,7 @@ class Animal public: void eat() { - std::cout << "I can eat!" << '\n'; + std::cout << "I can eat!\n"; } }; @@ -40,7 +40,7 @@ class Mammal public: void breath() { - std::cout << "I can breathe!" << '\n'; + std::cout << "I can breathe!\n"; } }; @@ -50,7 +50,7 @@ class Dog : public Animal, public Mammal public: void bark() { - std::cout << "I can bark! Woof woof!" << '\n'; + std::cout << "I can bark! Woof woof!\n"; } }; diff --git a/src/data/roadmaps/cpp/content/multithreading@OXQUPqxzs1-giAACwl3X1.md b/src/data/roadmaps/cpp/content/multithreading@OXQUPqxzs1-giAACwl3X1.md index ec908a8e7..aab6538cf 100644 --- a/src/data/roadmaps/cpp/content/multithreading@OXQUPqxzs1-giAACwl3X1.md +++ b/src/data/roadmaps/cpp/content/multithreading@OXQUPqxzs1-giAACwl3X1.md @@ -13,7 +13,7 @@ To create a new thread, include the `` header file and create an instanc #include void my_function() { - std::cout << "This function is executing in a separate thread" << '\n'; + std::cout << "This function is executing in a separate thread\n"; } int main() { diff --git a/src/data/roadmaps/cpp/content/object-oriented-programming@b3-QYKNcW3LYCNOza3Olf.md b/src/data/roadmaps/cpp/content/object-oriented-programming@b3-QYKNcW3LYCNOza3Olf.md index 916b6aea6..e6720cdb4 100644 --- a/src/data/roadmaps/cpp/content/object-oriented-programming@b3-QYKNcW3LYCNOza3Olf.md +++ b/src/data/roadmaps/cpp/content/object-oriented-programming@b3-QYKNcW3LYCNOza3Olf.md @@ -13,7 +13,7 @@ public: int age; void bark() { - std::cout << name << " barks!" << '\n'; + std::cout << name << " barks!\n"; } }; ``` @@ -47,7 +47,7 @@ public: } void bark() { - std::cout << name << " barks!" << '\n'; + std::cout << name << " barks!\n"; } }; ``` @@ -62,14 +62,14 @@ Inheritance is the concept of deriving new classes from existing ones, which ena class Animal { public: void breathe() { - std::cout << "I can breathe" << '\n'; + std::cout << "I can breathe\n"; } }; class Dog : public Animal { public: void bark() { - std::cout << "Dog barks!" << '\n'; + std::cout << "Dog barks!\n"; } }; ``` @@ -90,21 +90,21 @@ Polymorphism allows you to use a single interface to represent different types. class Animal { public: virtual void makeSound() { - std::cout << "The Animal makes a sound" << '\n'; + std::cout << "The Animal makes a sound\n"; } }; class Dog : public Animal { public: void makeSound() override { - std::cout << "Dog barks!" << '\n'; + std::cout << "Dog barks!\n"; } }; class Cat : public Animal { public: void makeSound() override { - std::cout << "Cat meows!" << '\n'; + std::cout << "Cat meows!\n"; } }; ``` diff --git a/src/data/roadmaps/cpp/content/pimpl@MEoWt8NKjPLVTeGgYf3cR.md b/src/data/roadmaps/cpp/content/pimpl@MEoWt8NKjPLVTeGgYf3cR.md index 60f6b1f16..846ab73a9 100644 --- a/src/data/roadmaps/cpp/content/pimpl@MEoWt8NKjPLVTeGgYf3cR.md +++ b/src/data/roadmaps/cpp/content/pimpl@MEoWt8NKjPLVTeGgYf3cR.md @@ -32,7 +32,7 @@ class MyClass_Impl // the actual implementation public: void some_method() { - std::cout << "Implementation method called!" << '\n'; + std::cout << "Implementation method called!\n"; } }; diff --git a/src/data/roadmaps/cpp/content/running-your-first-program@SEq0D2Zg5WTsIDtd1hW9f.md b/src/data/roadmaps/cpp/content/running-your-first-program@SEq0D2Zg5WTsIDtd1hW9f.md index 2b4a8416b..3f6df1781 100644 --- a/src/data/roadmaps/cpp/content/running-your-first-program@SEq0D2Zg5WTsIDtd1hW9f.md +++ b/src/data/roadmaps/cpp/content/running-your-first-program@SEq0D2Zg5WTsIDtd1hW9f.md @@ -10,7 +10,7 @@ The first program that most people learn to write in any programming language is #include int main() { - std::cout << "Hello, World!" << '\n'; + std::cout << "Hello, World!\n"; return 0; } ``` @@ -40,7 +40,7 @@ int main() { To output text to the console, we use the `std::cout` object and the insertion operator `<<`. In the "Hello, World!" example, we used the following line to print "Hello, World!" to the console: ```cpp -std::cout << "Hello, World!" << '\n'; +std::cout << "Hello, World!\n"; ``` - `std`: This is the namespace where C++ standard library entities (classes and functions) reside. It stands for "standard" - `std::cout`: The standard "character output" stream that writes to the console diff --git a/src/data/roadmaps/cpp/content/setting-up-your-environment@Zc_TTzmM36yWsu3GvOy9x.md b/src/data/roadmaps/cpp/content/setting-up-your-environment@Zc_TTzmM36yWsu3GvOy9x.md index cf27b3567..12bbfad33 100644 --- a/src/data/roadmaps/cpp/content/setting-up-your-environment@Zc_TTzmM36yWsu3GvOy9x.md +++ b/src/data/roadmaps/cpp/content/setting-up-your-environment@Zc_TTzmM36yWsu3GvOy9x.md @@ -38,7 +38,7 @@ Create a new file called `main.cpp` within your project and include this code: #include int main() { - std::cout << "Hello, World!" << '\n'; + std::cout << "Hello, World!\n"; return 0; } ``` diff --git a/src/data/roadmaps/cpp/content/sfinae@3C5UfejDX-1Z8ZF6C53xD.md b/src/data/roadmaps/cpp/content/sfinae@3C5UfejDX-1Z8ZF6C53xD.md index e9a7852d2..b097235ee 100644 --- a/src/data/roadmaps/cpp/content/sfinae@3C5UfejDX-1Z8ZF6C53xD.md +++ b/src/data/roadmaps/cpp/content/sfinae@3C5UfejDX-1Z8ZF6C53xD.md @@ -15,14 +15,14 @@ Here's an example that demonstrates SFINAE in action: template struct foo_impl { void operator()(T t) { - std::cout << "Called when T is not arithmetic" << '\n'; + std::cout << "Called when T is not arithmetic\n"; } }; template struct foo_impl::value>> { void operator()(T t) { - std::cout << "Called when T is arithmetic" << '\n'; + std::cout << "Called when T is arithmetic\n"; } };