diff --git a/src/data/roadmaps/cpp/content/argument-dependent-lookup-adl@YSWN7nS8vA9nMldSUrZRT.md b/src/data/roadmaps/cpp/content/argument-dependent-lookup-adl@YSWN7nS8vA9nMldSUrZRT.md index 5508a9aa0..29d178c5d 100644 --- a/src/data/roadmaps/cpp/content/argument-dependent-lookup-adl@YSWN7nS8vA9nMldSUrZRT.md +++ b/src/data/roadmaps/cpp/content/argument-dependent-lookup-adl@YSWN7nS8vA9nMldSUrZRT.md @@ -25,7 +25,7 @@ int main() { MyNamespace::MyClass obj; obj.value = 42; using std::cout; // Required to use 'cout' without fully qualifying it. - cout << obj << std::endl; // ADL is used to find the correct overloaded 'operator<<'. + cout << obj << '\n'; // ADL is used to find the correct overloaded 'operator<<'. } ``` diff --git a/src/data/roadmaps/cpp/content/auto-automatic-type-deduction@CG01PTVgHtjfKvsJkJLGl.md b/src/data/roadmaps/cpp/content/auto-automatic-type-deduction@CG01PTVgHtjfKvsJkJLGl.md index 6759a5f1f..2fea82738 100644 --- a/src/data/roadmaps/cpp/content/auto-automatic-type-deduction@CG01PTVgHtjfKvsJkJLGl.md +++ b/src/data/roadmaps/cpp/content/auto-automatic-type-deduction@CG01PTVgHtjfKvsJkJLGl.md @@ -24,12 +24,12 @@ int main() { // Without auto, iterating the vector would look like this: for (std::vector::iterator it = myVector.begin(); it != myVector.end(); ++it) { - std::cout << *it << std::endl; + std::cout << *it << '\n'; } // With auto, the iterator declaration becomes simpler: for (auto it = myVector.begin(); it != myVector.end(); ++it) { - std::cout << *it << std::endl; + std::cout << *it << '\n'; } } ``` diff --git a/src/data/roadmaps/cpp/content/c-0x@PPg0V5EzGBeJsysg1215V.md b/src/data/roadmaps/cpp/content/c-0x@PPg0V5EzGBeJsysg1215V.md index 2cf9e93f1..9366e4c03 100644 --- a/src/data/roadmaps/cpp/content/c-0x@PPg0V5EzGBeJsysg1215V.md +++ b/src/data/roadmaps/cpp/content/c-0x@PPg0V5EzGBeJsysg1215V.md @@ -16,7 +16,7 @@ Some of the notable features in C++11 include: ```cpp std::vector vec = {1, 2, 3}; for (int i : vec) { - std::cout << i << std::endl; + std::cout << i << '\n'; } ``` diff --git a/src/data/roadmaps/cpp/content/c-11--14@T6rCTv9Dxkm-tEA-l9XEv.md b/src/data/roadmaps/cpp/content/c-11--14@T6rCTv9Dxkm-tEA-l9XEv.md index 0215c7708..5ad367dff 100644 --- a/src/data/roadmaps/cpp/content/c-11--14@T6rCTv9Dxkm-tEA-l9XEv.md +++ b/src/data/roadmaps/cpp/content/c-11--14@T6rCTv9Dxkm-tEA-l9XEv.md @@ -13,7 +13,7 @@ The C++11 standard, also known as C++0x, was officially released in September 20 ```cpp std::vector numbers {1, 2, 3, 4}; for (int number : numbers) { - std::cout << number << std::endl; + std::cout << number << '\n'; } ``` diff --git a/src/data/roadmaps/cpp/content/c-20@o3no4a5_iMFzEAGs56-BJ.md b/src/data/roadmaps/cpp/content/c-20@o3no4a5_iMFzEAGs56-BJ.md index 06063c654..ff554af15 100644 --- a/src/data/roadmaps/cpp/content/c-20@o3no4a5_iMFzEAGs56-BJ.md +++ b/src/data/roadmaps/cpp/content/c-20@o3no4a5_iMFzEAGs56-BJ.md @@ -57,7 +57,7 @@ std::future async_value(int value) { int main() { auto result = async_value(42); - std::cout << "Result: " << result.get() << std::endl; + std::cout << "Result: " << result.get() << '\n'; } ``` 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 9134d8010..9c119abae 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!" << std::endl; + std::cout << "Hello, World!" << '\n'; } }; diff --git a/src/data/roadmaps/cpp/content/compiler-stages@DVckzBUMgk_lWThVkLyAT.md b/src/data/roadmaps/cpp/content/compiler-stages@DVckzBUMgk_lWThVkLyAT.md index cbe299a67..5d6c54132 100644 --- a/src/data/roadmaps/cpp/content/compiler-stages@DVckzBUMgk_lWThVkLyAT.md +++ b/src/data/roadmaps/cpp/content/compiler-stages@DVckzBUMgk_lWThVkLyAT.md @@ -13,7 +13,7 @@ The first stage is the preprocessing of the source code. Preprocessors modify th #define PI 3.14 int main() { - std::cout << "The value of PI is: " << PI << std::endl; + std::cout << "The value of PI is: " << PI << '\n'; return 0; } ``` diff --git a/src/data/roadmaps/cpp/content/compilers@FTMHsUiE8isD_OVZr62Xc.md b/src/data/roadmaps/cpp/content/compilers@FTMHsUiE8isD_OVZr62Xc.md index fa6e5b4c9..89f5b34f9 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!" << std::endl; + std::cout << "Hello, World!" << '\n'; return 0; } ``` diff --git a/src/data/roadmaps/cpp/content/const_cast@5g22glc97siQOcTkHbwan.md b/src/data/roadmaps/cpp/content/const_cast@5g22glc97siQOcTkHbwan.md index 8a1e24599..5a99d01df 100644 --- a/src/data/roadmaps/cpp/content/const_cast@5g22glc97siQOcTkHbwan.md +++ b/src/data/roadmaps/cpp/content/const_cast@5g22glc97siQOcTkHbwan.md @@ -19,10 +19,10 @@ void modifyVariable(int* ptr) { int main() { const int original_value = 10; int* non_const_value_ptr = const_cast(&original_value); - std::cout << "Original value: " << original_value << std::endl; + std::cout << "Original value: " << original_value << '\n'; modifyVariable(non_const_value_ptr); - std::cout << "Modified value: " << *non_const_value_ptr << ", original_value: " << original_value << std::endl; + std::cout << "Modified value: " << *non_const_value_ptr << ", original_value: " << original_value << '\n'; assert(non_const_value_ptr == &original_value); diff --git a/src/data/roadmaps/cpp/content/containers@1pydf-SR0QUfVNuBEyvzc.md b/src/data/roadmaps/cpp/content/containers@1pydf-SR0QUfVNuBEyvzc.md index 07276bf00..bf980d8e4 100644 --- a/src/data/roadmaps/cpp/content/containers@1pydf-SR0QUfVNuBEyvzc.md +++ b/src/data/roadmaps/cpp/content/containers@1pydf-SR0QUfVNuBEyvzc.md @@ -21,7 +21,7 @@ int main() { for (int x : vec) { std::cout << ' ' << x; } - std::cout << std::endl; + std::cout << '\n'; } ``` @@ -44,7 +44,7 @@ int main() { for (int x : lst) { std::cout << ' ' << x; } - std::cout << std::endl; + std::cout << '\n'; } ``` @@ -64,9 +64,9 @@ int main() { m["one"] = 1; m["two"] = 2; - std::cout << "Map contains:" << std::endl; + std::cout << "Map contains:" << '\n'; for (const auto &pair : m) { - std::cout << pair.first << ": " << pair.second << std::endl; + std::cout << pair.first << ": " << pair.second << '\n'; } } ``` @@ -87,9 +87,9 @@ int main() { um["one"] = 1; um["two"] = 2; - std::cout << "Unordered map contains:" << std::endl; + std::cout << "Unordered map contains:" << '\n'; for (const auto &pair : um) { - std::cout << pair.first << ": " << pair.second << std::endl; + 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 df24f912c..39ead88f0 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." << std::endl; + 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." << std::endl; + 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 e09f1ed22..52d19eb73 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" << std::endl; + std::cout << "Default implementation in Base" << '\n'; } }; class Derived1 : public Base { public: void implementation() { - std::cout << "Custom implementation in Derived1" << std::endl; + std::cout << "Custom implementation in Derived1" << '\n'; } }; diff --git a/src/data/roadmaps/cpp/content/data-types@MwznA4qfpNlv6sqSNjPZi.md b/src/data/roadmaps/cpp/content/data-types@MwznA4qfpNlv6sqSNjPZi.md index 84136bad0..d3776df0b 100644 --- a/src/data/roadmaps/cpp/content/data-types@MwznA4qfpNlv6sqSNjPZi.md +++ b/src/data/roadmaps/cpp/content/data-types@MwznA4qfpNlv6sqSNjPZi.md @@ -109,7 +109,7 @@ public: int age; void printInfo() { - std::cout << "Name: " << name << ", Age: " << age << std::endl; + std::cout << "Name: " << name << ", Age: " << age << '\n'; }; }; diff --git a/src/data/roadmaps/cpp/content/date--time@yGvE6eHKlPMBB6rde0llR.md b/src/data/roadmaps/cpp/content/date--time@yGvE6eHKlPMBB6rde0llR.md index 7538f69d8..047afd9e8 100644 --- a/src/data/roadmaps/cpp/content/date--time@yGvE6eHKlPMBB6rde0llR.md +++ b/src/data/roadmaps/cpp/content/date--time@yGvE6eHKlPMBB6rde0llR.md @@ -82,7 +82,7 @@ To convert a time point to calendar representation, you can use the `std::chrono int main() { std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); std::time_t now_c = std::chrono::system_clock::to_time_t(now); - std::cout << "Current time: " << std::ctime(&now_c) << std::endl; + std::cout << "Current time: " << std::ctime(&now_c) << '\n'; return 0; } ``` diff --git a/src/data/roadmaps/cpp/content/diamond-inheritance@ofwdZm05AUqCIWmfgGHk8.md b/src/data/roadmaps/cpp/content/diamond-inheritance@ofwdZm05AUqCIWmfgGHk8.md index 136b45012..cc166d6bd 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" << std::endl; + std::cout << "Base class" << '\n'; } }; class Derived1 : virtual public Base { public: void derived1Print() { - std::cout << "Derived1 class" << std::endl; + std::cout << "Derived1 class" << '\n'; } }; class Derived2 : virtual public Base { public: void derived2Print() { - std::cout << "Derived2 class" << std::endl; + std::cout << "Derived2 class" << '\n'; } }; class Derived3 : public Derived1, public Derived2 { public: void derived3Print() { - std::cout << "Derived3 class" << std::endl; + 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 a76f419e3..d16395882 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" << std::endl; + std::cout << "Drawing a shape" << '\n'; } }; @@ -23,7 +23,7 @@ public: class Circle : public Shape { public: void draw() override { - std::cout << "Drawing a circle" << std::endl; + std::cout << "Drawing a circle" << '\n'; } }; @@ -31,7 +31,7 @@ public: class Rectangle : public Shape { public: void draw() override { - std::cout << "Drawing a rectangle" << std::endl; + std::cout << "Drawing a rectangle" << '\n'; } }; diff --git a/src/data/roadmaps/cpp/content/dynamic-typing@i0EAFEUB-F0wBJWOtrl1A.md b/src/data/roadmaps/cpp/content/dynamic-typing@i0EAFEUB-F0wBJWOtrl1A.md index 473e30fb0..63772d398 100644 --- a/src/data/roadmaps/cpp/content/dynamic-typing@i0EAFEUB-F0wBJWOtrl1A.md +++ b/src/data/roadmaps/cpp/content/dynamic-typing@i0EAFEUB-F0wBJWOtrl1A.md @@ -20,13 +20,13 @@ int main() { void* void_ptr; void_ptr = &x; - std::cout << "int value: " << *(static_cast(void_ptr)) << std::endl; + std::cout << "int value: " << *(static_cast(void_ptr)) << '\n'; void_ptr = &y; - std::cout << "float value: " << *(static_cast(void_ptr)) << std::endl; + std::cout << "float value: " << *(static_cast(void_ptr)) << '\n'; void_ptr = &z; - std::cout << "string value: " << *(static_cast(void_ptr)) << std::endl; + std::cout << "string value: " << *(static_cast(void_ptr)) << '\n'; return 0; } @@ -45,13 +45,13 @@ int main() { std::any any_value; any_value = 42; - std::cout << "int value: " << std::any_cast(any_value) << std::endl; + std::cout << "int value: " << std::any_cast(any_value) << '\n'; any_value = 3.14; - std::cout << "double value: " << std::any_cast(any_value) << std::endl; + std::cout << "double value: " << std::any_cast(any_value) << '\n'; any_value = std::string("Hello, world!"); - std::cout << "string value: " << std::any_cast(any_value) << std::endl; + std::cout << "string value: " << std::any_cast(any_value) << '\n'; return 0; } 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 622f17f5d..c0a83e0ce 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" << std::endl; + std::cout << "BaseClass" << '\n'; } }; class DerivedClass : public BaseClass { public: void display() { - std::cout << "DerivedClass" << std::endl; + std::cout << "DerivedClass" << '\n'; } }; diff --git a/src/data/roadmaps/cpp/content/exception-handling@B2SGBENzUMl0SAjG4j91V.md b/src/data/roadmaps/cpp/content/exception-handling@B2SGBENzUMl0SAjG4j91V.md index d5b6fb09c..7dac56b42 100644 --- a/src/data/roadmaps/cpp/content/exception-handling@B2SGBENzUMl0SAjG4j91V.md +++ b/src/data/roadmaps/cpp/content/exception-handling@B2SGBENzUMl0SAjG4j91V.md @@ -31,9 +31,9 @@ int main() { try { int result = divide(num1, num2); - std::cout << "The result is: " << result << std::endl; + std::cout << "The result is: " << result << '\n'; } catch (const char* msg) { - std::cerr << "Error: " << msg << std::endl; + std::cerr << "Error: " << msg << '\n'; } return 0; @@ -71,9 +71,9 @@ int main() { try { int result = divide(num1, num2); - std::cout << "The result is: " << result << std::endl; + std::cout << "The result is: " << result << '\n'; } catch (const std::exception& e) { - std::cerr << "Error: " << e.what() << std::endl; + std::cerr << "Error: " << e.what() << '\n'; } return 0; diff --git a/src/data/roadmaps/cpp/content/exceptions@NJud5SXBAUZ6Sr78kZ7jx.md b/src/data/roadmaps/cpp/content/exceptions@NJud5SXBAUZ6Sr78kZ7jx.md index 36f0506af..47dfa28a5 100644 --- a/src/data/roadmaps/cpp/content/exceptions@NJud5SXBAUZ6Sr78kZ7jx.md +++ b/src/data/roadmaps/cpp/content/exceptions@NJud5SXBAUZ6Sr78kZ7jx.md @@ -39,11 +39,11 @@ try { throw "Division by zero not allowed!"; } else { int result = num1 / num2; - std::cout << "Result: " << result << std::endl; + std::cout << "Result: " << result << '\n'; } } catch (const char* e) { - std::cout << "Error: " << e << std::endl; + std::cout << "Error: " << e << '\n'; } ``` diff --git a/src/data/roadmaps/cpp/content/exit-codes@oWygnpwHq2poXQMTTSCpl.md b/src/data/roadmaps/cpp/content/exit-codes@oWygnpwHq2poXQMTTSCpl.md index cb3e919a2..bdd8856a7 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." << std::endl; + std::cout << "An error occurred." << '\n'; return 1; } // More code here... if (/*another error condition*/) { - std::cout << "Another error occurred." << std::endl; + 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." << std::endl; + std::cout << "An error occurred." << '\n'; std::exit(1); } diff --git a/src/data/roadmaps/cpp/content/for--while--do-while-loops@_IP_e1K9LhNHilYTDh7L5.md b/src/data/roadmaps/cpp/content/for--while--do-while-loops@_IP_e1K9LhNHilYTDh7L5.md index 7fe661985..5792de0c7 100644 --- a/src/data/roadmaps/cpp/content/for--while--do-while-loops@_IP_e1K9LhNHilYTDh7L5.md +++ b/src/data/roadmaps/cpp/content/for--while--do-while-loops@_IP_e1K9LhNHilYTDh7L5.md @@ -21,7 +21,7 @@ For example: int main() { for (int i = 0; i < 5; i++) { - std::cout << "Iteration: " << i << std::endl; + std::cout << "Iteration: " << i << '\n'; } return 0; } @@ -47,7 +47,7 @@ For example: int main() { int i = 0; while (i < 5) { - std::cout << "Iteration: " << i << std::endl; + std::cout << "Iteration: " << i << '\n'; i++; } return 0; @@ -74,7 +74,7 @@ For example: int main() { int i = 0; do { - std::cout << "Iteration: " << i << std::endl; + std::cout << "Iteration: " << i << '\n'; i++; } while (i < 5); return 0; 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 98f2c13ea..c73491db1 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." << std::endl; + std::cout << "Generic container." << '\n'; } }; @@ -28,7 +28,7 @@ template <> class MyContainer { public: void print() { - std::cout << "Container for integers." << std::endl; + std::cout << "Container for integers." << '\n'; } }; diff --git a/src/data/roadmaps/cpp/content/functions@oYi3YOc1GC2Nfp71VOkJt.md b/src/data/roadmaps/cpp/content/functions@oYi3YOc1GC2Nfp71VOkJt.md index d4db1f6c8..0422126cd 100644 --- a/src/data/roadmaps/cpp/content/functions@oYi3YOc1GC2Nfp71VOkJt.md +++ b/src/data/roadmaps/cpp/content/functions@oYi3YOc1GC2Nfp71VOkJt.md @@ -36,7 +36,7 @@ int addNumbers(int a, int b) { int main() { int num1 = 5, num2 = 10; int result = addNumbers(num1, num2); // Calling the function - std::cout << "The sum is: " << result << std::endl; + std::cout << "The sum is: " << result << '\n'; return 0; } ``` @@ -58,7 +58,7 @@ int multiplyNumbers(int x, int y); int main() { int num1 = 3, num2 = 7; int result = multiplyNumbers(num1, num2); // Calling the function - std::cout << "The product is: " << result << std::endl; + std::cout << "The product is: " << result << '\n'; return 0; } diff --git a/src/data/roadmaps/cpp/content/gdb@BmWsoL9c_Aag5nVlMsKm2.md b/src/data/roadmaps/cpp/content/gdb@BmWsoL9c_Aag5nVlMsKm2.md index 78f255ac7..68f6b9868 100644 --- a/src/data/roadmaps/cpp/content/gdb@BmWsoL9c_Aag5nVlMsKm2.md +++ b/src/data/roadmaps/cpp/content/gdb@BmWsoL9c_Aag5nVlMsKm2.md @@ -38,7 +38,7 @@ Suppose you have a simple `cpp` file called `example.cpp`: #include void my_function(int i) { - std::cout << "In my_function with i = " << i << std::endl; + std::cout << "In my_function with i = " << i << '\n'; } int main() { 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 4a9323506..3625ad563 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!" << std::endl; + std::cout << "Hello, code splitting!" << '\n'; } ``` diff --git a/src/data/roadmaps/cpp/content/introduction-to-language@NvODRFR0DLINB0RlPSsvt.md b/src/data/roadmaps/cpp/content/introduction-to-language@NvODRFR0DLINB0RlPSsvt.md index 0231d2e86..886099ba1 100644 --- a/src/data/roadmaps/cpp/content/introduction-to-language@NvODRFR0DLINB0RlPSsvt.md +++ b/src/data/roadmaps/cpp/content/introduction-to-language@NvODRFR0DLINB0RlPSsvt.md @@ -36,7 +36,7 @@ int main() { int number; std::cout << "Enter an integer: "; std::cin >> number; - std::cout << "You entered: " << number << std::endl; + std::cout << "You entered: " << number << '\n'; return 0; } ``` @@ -124,7 +124,7 @@ int add(int a, int b) { int main() { int result = add(3, 4); - std::cout << "3 + 4 = " << result << std::endl; + std::cout << "3 + 4 = " << result << '\n'; return 0; } ``` diff --git a/src/data/roadmaps/cpp/content/iostream@VeVxZ230xkesQsIDig8zQ.md b/src/data/roadmaps/cpp/content/iostream@VeVxZ230xkesQsIDig8zQ.md index 0d6f4c7aa..18ff5ab60 100644 --- a/src/data/roadmaps/cpp/content/iostream@VeVxZ230xkesQsIDig8zQ.md +++ b/src/data/roadmaps/cpp/content/iostream@VeVxZ230xkesQsIDig8zQ.md @@ -26,7 +26,7 @@ int main() { int a; std::cout << "Enter a number: "; std::cin >> a; - std::cout << "You entered: " << a << std::endl; + std::cout << "You entered: " << a << '\n'; return 0; } ``` @@ -35,8 +35,8 @@ int main() { #include int main() { - std::cerr << "An error occurred." << std::endl; - std::clog << "Logging information." << std::endl; + 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 69a03f86a..10d4a1f9b 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!" << std::endl; + 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 35dbc5c2f..14279deb4 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." << std::endl; + 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." << std::endl; + 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." << std::endl; + 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." << std::endl; + 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 03ab96510..e617ef034 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!" << std::endl; + std::cout << "I can eat!" << '\n'; } }; @@ -40,7 +40,7 @@ class Mammal public: void breath() { - std::cout << "I can breathe!" << std::endl; + 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!" << std::endl; + 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 ef03c0e78..ec908a8e7 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" << std::endl; + std::cout << "This function is executing in a separate thread" << '\n'; } int main() { @@ -32,7 +32,7 @@ You can pass arguments to the thread function by providing them as additional ar #include void print_sum(int a, int b) { - std::cout << "The sum is: " << a + b << std::endl; + std::cout << "The sum is: " << a + b << '\n'; } int main() { @@ -59,7 +59,7 @@ void print_block(int n, char c) { for (int i = 0; i < n; ++i) { std::cout << c; } - std::cout << std::endl; + std::cout << '\n'; } } diff --git a/src/data/roadmaps/cpp/content/namespaces@iIdC7V8sojwyEqK1xMuHn.md b/src/data/roadmaps/cpp/content/namespaces@iIdC7V8sojwyEqK1xMuHn.md index 41de1c235..d530de394 100644 --- a/src/data/roadmaps/cpp/content/namespaces@iIdC7V8sojwyEqK1xMuHn.md +++ b/src/data/roadmaps/cpp/content/namespaces@iIdC7V8sojwyEqK1xMuHn.md @@ -27,8 +27,8 @@ namespace animals { } int main() { - std::cout << "Dog's name: " << animals::dog << std::endl; - std::cout << "Cat's name: " << animals::cat << std::endl; + std::cout << "Dog's name: " << animals::dog << '\n'; + std::cout << "Cat's name: " << animals::cat << '\n'; return 0; } @@ -50,8 +50,8 @@ namespace outer { } int main() { - std::cout << "Outer x: " << outer::x << std::endl; - std::cout << "Inner y: " << outer::inner::y << std::endl; + std::cout << "Outer x: " << outer::x << '\n'; + std::cout << "Inner y: " << outer::inner::y << '\n'; return 0; } @@ -74,7 +74,7 @@ namespace animals { int main() { using animals::dog; - std::cout << "Dog's name: " << dog << std::endl; + std::cout << "Dog's name: " << dog << '\n'; return 0; } @@ -93,8 +93,8 @@ namespace animals { int main() { using namespace animals; - std::cout << "Dog's name: " << dog << std::endl; - std::cout << "Cat's name: " << cat << std::endl; + std::cout << "Dog's name: " << dog << '\n'; + std::cout << "Cat's name: " << cat << '\n'; return 0; } 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 ef4cc7863..916b6aea6 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!" << std::endl; + std::cout << name << " barks!" << '\n'; } }; ``` @@ -47,7 +47,7 @@ public: } void bark() { - std::cout << name << " barks!" << std::endl; + 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" << std::endl; + std::cout << "I can breathe" << '\n'; } }; class Dog : public Animal { public: void bark() { - std::cout << "Dog barks!" << std::endl; + 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" << std::endl; + std::cout << "The Animal makes a sound" << '\n'; } }; class Dog : public Animal { public: void makeSound() override { - std::cout << "Dog barks!" << std::endl; + std::cout << "Dog barks!" << '\n'; } }; class Cat : public Animal { public: void makeSound() override { - std::cout << "Cat meows!" << std::endl; + std::cout << "Cat meows!" << '\n'; } }; ``` diff --git a/src/data/roadmaps/cpp/content/partial-template-specialization@1NYJtbdcdOB4-vIrnq4yX.md b/src/data/roadmaps/cpp/content/partial-template-specialization@1NYJtbdcdOB4-vIrnq4yX.md index cc9e0ad9c..1b1ae5a34 100644 --- a/src/data/roadmaps/cpp/content/partial-template-specialization@1NYJtbdcdOB4-vIrnq4yX.md +++ b/src/data/roadmaps/cpp/content/partial-template-specialization@1NYJtbdcdOB4-vIrnq4yX.md @@ -36,9 +36,9 @@ int main() { MyTemplate t2; // Partial specialization for pointers MyTemplate t3; // Full specialization for int - std::cout << t1.name() << std::endl; - std::cout << t2.name() << std::endl; - std::cout << t3.name() << std::endl; + std::cout << t1.name() << '\n'; + std::cout << t2.name() << '\n'; + std::cout << t3.name() << '\n'; return 0; } diff --git a/src/data/roadmaps/cpp/content/pimpl@MEoWt8NKjPLVTeGgYf3cR.md b/src/data/roadmaps/cpp/content/pimpl@MEoWt8NKjPLVTeGgYf3cR.md index 2229e8cd9..60f6b1f16 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!" << std::endl; + std::cout << "Implementation method called!" << '\n'; } }; diff --git a/src/data/roadmaps/cpp/content/references@uUzRKa9wGzdUwwmAg3FWr.md b/src/data/roadmaps/cpp/content/references@uUzRKa9wGzdUwwmAg3FWr.md index af0de8dc1..a3cf4dc80 100644 --- a/src/data/roadmaps/cpp/content/references@uUzRKa9wGzdUwwmAg3FWr.md +++ b/src/data/roadmaps/cpp/content/references@uUzRKa9wGzdUwwmAg3FWr.md @@ -14,10 +14,10 @@ You can use the reference just like you'd use the original variable. When you ch ```cpp var = 20; // Sets the value of var to 20 -std::cout << ref << std::endl; // Outputs 20 +std::cout << ref << '\n'; // Outputs 20 ref = 30; // Sets the value of ref to 30 -std::cout << var << std::endl; // Outputs 30 +std::cout << var << '\n'; // Outputs 30 ``` ## Function Parameters @@ -31,9 +31,9 @@ void swap(int& a, int& b) { int main() { int x = 5, y = 10; - std::cout << "Before Swap: x = " << x << " y = " << y << std::endl; // Outputs 5 10 + std::cout << "Before Swap: x = " << x << " y = " << y << '\n'; // Outputs 5 10 swap(x, y); - std::cout << "After Swap: x = " << x << " y = " << y << std::endl; // Outputs 10 5 + std::cout << "After Swap: x = " << x << " y = " << y << '\n'; // Outputs 10 5 } ``` diff --git a/src/data/roadmaps/cpp/content/reinterpret_cast@ZMyFDJrpCauGrY5NZkOwg.md b/src/data/roadmaps/cpp/content/reinterpret_cast@ZMyFDJrpCauGrY5NZkOwg.md index f917ca5a2..319a4a3c5 100644 --- a/src/data/roadmaps/cpp/content/reinterpret_cast@ZMyFDJrpCauGrY5NZkOwg.md +++ b/src/data/roadmaps/cpp/content/reinterpret_cast@ZMyFDJrpCauGrY5NZkOwg.md @@ -18,7 +18,7 @@ int main() { for (size_t i = 0; i < sizeof(int); ++i) { // Print the individual bytes of the integer as characters - std::cout << "Byte " << i << ": " << char_ptr[i] << std::endl; + std::cout << "Byte " << i << ": " << char_ptr[i] << '\n'; } return 0; 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 8d6633b01..4e1651dea 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!" << std::endl; + std::cout << "Hello, World!" << '\n'; return 0; } ``` @@ -40,12 +40,12 @@ 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!" << std::endl; +std::cout << "Hello, World!" << '\n'; ``` - `std`: This is the namespace where C++ standard library entities (classes and functions) reside. It stands for "standard" and is an abbreviation for the Standard Template Library (STL). - `std::cout`: The standard "character output" stream that writes to the console - `"Hello, World!"`: The string literal to print -- `std::endl`: The "end line" manipulator that inserts a newline character and flushes the output buffer +- `'\n'`: The "end line" manipulator that inserts a newline character and flushes the output buffer ## Return Statement diff --git a/src/data/roadmaps/cpp/content/scope@dKCYmxDNZubCVcR5rf8b-.md b/src/data/roadmaps/cpp/content/scope@dKCYmxDNZubCVcR5rf8b-.md index 7445b5083..1a711c726 100644 --- a/src/data/roadmaps/cpp/content/scope@dKCYmxDNZubCVcR5rf8b-.md +++ b/src/data/roadmaps/cpp/content/scope@dKCYmxDNZubCVcR5rf8b-.md @@ -10,7 +10,7 @@ int globalVar; // This is a global variable int main() { - std::cout << "Global variable: " << globalVar << std::endl; + std::cout << "Global variable: " << globalVar << '\n'; } ``` @@ -22,12 +22,12 @@ int main() { void localExample() { int localVar; // This is a local variable localVar = 5; - std::cout << "Local variable: " << localVar << std::endl; + std::cout << "Local variable: " << localVar << '\n'; } int main() { localExample(); - // std::cout << localVar << std::endl; //error: ‘localVar’ was not declared in this scope + // std::cout << localVar << '\n'; //error: ‘localVar’ was not declared in this scope } ``` @@ -41,7 +41,7 @@ namespace MyNamespace { } int main() { - std::cout << "Namespace variable: " << MyNamespace::namespaceVar << std::endl; + std::cout << "Namespace variable: " << MyNamespace::namespaceVar << '\n'; } ``` @@ -62,8 +62,8 @@ int MyClass::staticMember = 7; int main() { MyClass obj(10); - std::cout << "Static member: " << MyClass::staticMember << std::endl; - std::cout << "Non-static member: " << obj.nonStaticMember << std::endl; + std::cout << "Static member: " << MyClass::staticMember << '\n'; + std::cout << "Non-static member: " << obj.nonStaticMember << '\n'; } ``` 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 d66ffab97..cf27b3567 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!" << std::endl; + 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 6d23f9647..e9a7852d2 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" << std::endl; + 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" << std::endl; + std::cout << "Called when T is arithmetic" << '\n'; } }; diff --git a/src/data/roadmaps/cpp/content/standardds@vvE1aUsWbF1OFcmMUHbJa.md b/src/data/roadmaps/cpp/content/standardds@vvE1aUsWbF1OFcmMUHbJa.md index d8af0b35b..5940deba6 100644 --- a/src/data/roadmaps/cpp/content/standardds@vvE1aUsWbF1OFcmMUHbJa.md +++ b/src/data/roadmaps/cpp/content/standardds@vvE1aUsWbF1OFcmMUHbJa.md @@ -15,7 +15,7 @@ Here's a brief summary of the different C++ standards released to date: ```cpp std::vector numbers = {1, 2, 3, 4}; for (int num : numbers) { - std::cout << num << std::endl; + std::cout << num << '\n'; } ``` - Smart pointers like `std::shared_ptr` and `std::unique_ptr`. diff --git a/src/data/roadmaps/cpp/content/static-polymorphism@obZIxRp0eMWdG7gplNIBc.md b/src/data/roadmaps/cpp/content/static-polymorphism@obZIxRp0eMWdG7gplNIBc.md index 0ed72c8d9..15bbf723b 100644 --- a/src/data/roadmaps/cpp/content/static-polymorphism@obZIxRp0eMWdG7gplNIBc.md +++ b/src/data/roadmaps/cpp/content/static-polymorphism@obZIxRp0eMWdG7gplNIBc.md @@ -12,15 +12,15 @@ Example: #include void print(int i) { - std::cout << "Printing int: " << i << std::endl; + std::cout << "Printing int: " << i << '\n'; } void print(double d) { - std::cout << "Printing double: " << d << std::endl; + std::cout << "Printing double: " << d << '\n'; } void print(const char* s) { - std::cout << "Printing string: " << s << std::endl; + std::cout << "Printing string: " << s << '\n'; } int main() { @@ -44,7 +44,7 @@ Example: // Template function to print any type template void print(const T& value) { - std::cout << "Printing value: " << value << std::endl; + std::cout << "Printing value: " << value << '\n'; } int main() { diff --git a/src/data/roadmaps/cpp/content/static-typing@f1djN0GxoeVPr_0cl6vMq.md b/src/data/roadmaps/cpp/content/static-typing@f1djN0GxoeVPr_0cl6vMq.md index 5df695ab0..cad4e721f 100644 --- a/src/data/roadmaps/cpp/content/static-typing@f1djN0GxoeVPr_0cl6vMq.md +++ b/src/data/roadmaps/cpp/content/static-typing@f1djN0GxoeVPr_0cl6vMq.md @@ -17,9 +17,9 @@ int main() { c = num; // This asssigment would convert num's value to ASCII equivalent character num = pi; // This assignment would convert pi's value from double type to int type - std::cout << "The value of num is: " << num << std::endl; - std::cout << "The value of pi is: " << pi << std::endl; - std::cout << "The value of c is: "<< c << std::endl; + std::cout << "The value of num is: " << num << '\n'; + std::cout << "The value of pi is: " << pi << '\n'; + std::cout << "The value of c is: "<< c << '\n'; return 0; } ``` diff --git a/src/data/roadmaps/cpp/content/structures-and-classes@CMlWNQwpywNhO9B6Yj6Me.md b/src/data/roadmaps/cpp/content/structures-and-classes@CMlWNQwpywNhO9B6Yj6Me.md index c7a34ab06..e0e492dab 100644 --- a/src/data/roadmaps/cpp/content/structures-and-classes@CMlWNQwpywNhO9B6Yj6Me.md +++ b/src/data/roadmaps/cpp/content/structures-and-classes@CMlWNQwpywNhO9B6Yj6Me.md @@ -48,7 +48,7 @@ public: void display() { std::cout << "Roll no: " << roll_no << "\nName: " << name - << "\nMarks: " << marks << std::endl; + << "\nMarks: " << marks << '\n'; } }; diff --git a/src/data/roadmaps/cpp/content/template-specialization@sObOuccY0PDeGG-9GrFDF.md b/src/data/roadmaps/cpp/content/template-specialization@sObOuccY0PDeGG-9GrFDF.md index 041ab1827..e0fa2461f 100644 --- a/src/data/roadmaps/cpp/content/template-specialization@sObOuccY0PDeGG-9GrFDF.md +++ b/src/data/roadmaps/cpp/content/template-specialization@sObOuccY0PDeGG-9GrFDF.md @@ -19,12 +19,12 @@ Here is an example: template void printData(const T& data) { - std::cout << "General template: " << data << std::endl; + std::cout << "General template: " << data << '\n'; } template <> void printData(const char* const & data) { - std::cout << "Specialized template for const char*: " << data << std::endl; + std::cout << "Specialized template for const char*: " << data << '\n'; } int main() { @@ -50,7 +50,7 @@ public: MyPair(K k, V v) : key(k), value(v) {} void print() const { - std::cout << "General template: key = " << key << ", value = " << value << std::endl; + std::cout << "General template: key = " << key << ", value = " << value << '\n'; } private: @@ -65,7 +65,7 @@ public: void print() const { std::cout << "Partial specialization for int values: key = " << key - << ", value = " << value << std::endl; + << ", value = " << value << '\n'; } private: diff --git a/src/data/roadmaps/cpp/content/type-traits@WptReUOwVth3C9-AVmMHF.md b/src/data/roadmaps/cpp/content/type-traits@WptReUOwVth3C9-AVmMHF.md index 0c53b48c7..964f6aeaa 100644 --- a/src/data/roadmaps/cpp/content/type-traits@WptReUOwVth3C9-AVmMHF.md +++ b/src/data/roadmaps/cpp/content/type-traits@WptReUOwVth3C9-AVmMHF.md @@ -21,8 +21,8 @@ int main() { int a; int* a_ptr = &a; - std::cout << "Is 'a' a pointer? " << std::boolalpha << std::is_pointer::value << std::endl; - std::cout << "Is 'a_ptr' a pointer? " << std::boolalpha << std::is_pointer::value << std::endl; + std::cout << "Is 'a' a pointer? " << std::boolalpha << std::is_pointer::value << '\n'; + std::cout << "Is 'a_ptr' a pointer? " << std::boolalpha << std::is_pointer::value << '\n'; return 0; } @@ -46,7 +46,7 @@ typename std::enable_if::value, T>::type find_max(T a, T b int main() { int max = find_max(10, 20); - std::cout << "Max: " << max << std::endl; + std::cout << "Max: " << max << '\n'; return 0; } diff --git a/src/data/roadmaps/cpp/content/understanding-debugger-messages@VtPb8-AJKzhTB0QbMtoU4.md b/src/data/roadmaps/cpp/content/understanding-debugger-messages@VtPb8-AJKzhTB0QbMtoU4.md index 356e6ba26..8daa43940 100644 --- a/src/data/roadmaps/cpp/content/understanding-debugger-messages@VtPb8-AJKzhTB0QbMtoU4.md +++ b/src/data/roadmaps/cpp/content/understanding-debugger-messages@VtPb8-AJKzhTB0QbMtoU4.md @@ -51,7 +51,7 @@ int main() { int num2 = 0; int result = num1 / num2; - std::cout << "Result: " << result << std::endl; + std::cout << "Result: " << result << '\n'; return 0; } diff --git a/src/data/roadmaps/cpp/content/variadic-templates@w4EIf58KP-Pq-yc0HlGxc.md b/src/data/roadmaps/cpp/content/variadic-templates@w4EIf58KP-Pq-yc0HlGxc.md index 0c13275fa..2b69bab3b 100644 --- a/src/data/roadmaps/cpp/content/variadic-templates@w4EIf58KP-Pq-yc0HlGxc.md +++ b/src/data/roadmaps/cpp/content/variadic-templates@w4EIf58KP-Pq-yc0HlGxc.md @@ -33,7 +33,7 @@ T sum(T t, Args... args) { int main() { int result = sum(1, 2, 3, 4, 5); // expands to 1 + 2 + 3 + 4 + 5 - std::cout << "The sum is: " << result << std::endl; + std::cout << "The sum is: " << result << '\n'; return 0; } @@ -63,7 +63,7 @@ class Tuple : public Tuple { int main() { Tuple tuple(1, 2.0f, 3.0); - std::cout << "First element: " << tuple.head() << std::endl; + std::cout << "First element: " << tuple.head() << '\n'; return 0; } ``` diff --git a/src/data/roadmaps/cpp/content/what-is-c@x_28LiDVshqWns_aIBsdx.md b/src/data/roadmaps/cpp/content/what-is-c@x_28LiDVshqWns_aIBsdx.md index 94798136e..e4b6bbfd0 100644 --- a/src/data/roadmaps/cpp/content/what-is-c@x_28LiDVshqWns_aIBsdx.md +++ b/src/data/roadmaps/cpp/content/what-is-c@x_28LiDVshqWns_aIBsdx.md @@ -32,12 +32,12 @@ int main() { // Using the standalone function 'add' int sum = add(x, y); - std::cout << "Sum: " << sum << std::endl; + std::cout << "Sum: " << sum << '\n'; // Using a class and member function Calculator calc; int product = calc.multiply(x, y); - std::cout << "Product: " << product << std::endl; + std::cout << "Product: " << product << '\n'; return 0; } diff --git a/src/data/roadmaps/cpp/content/why-use-c@tl6VCQ5IEGDVyFcgj7jDm.md b/src/data/roadmaps/cpp/content/why-use-c@tl6VCQ5IEGDVyFcgj7jDm.md index 97490e21c..fb4fc6cb5 100644 --- a/src/data/roadmaps/cpp/content/why-use-c@tl6VCQ5IEGDVyFcgj7jDm.md +++ b/src/data/roadmaps/cpp/content/why-use-c@tl6VCQ5IEGDVyFcgj7jDm.md @@ -43,7 +43,7 @@ int main() { // High-level programming std::vector myVector = {1, 2, 3}; for (const auto &i: myVector) { - std::cout << i << std::endl; + std::cout << i << '\n'; } } ```