<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rajeshbhai on Medium]]></title>
        <description><![CDATA[Stories by Rajeshbhai on Medium]]></description>
        <link>https://medium.com/@rajeshbhai91718215?source=rss-210fc7373403------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ldq9Bg3sYntRvowT-DWIrg.jpeg</url>
            <title>Stories by Rajeshbhai on Medium</title>
            <link>https://medium.com/@rajeshbhai91718215?source=rss-210fc7373403------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 10:26:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rajeshbhai91718215/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Coding class me swagats hai]]></title>
            <link>https://medium.com/@rajeshbhai91718215/coding-class-me-swagats-hai-e8376654b694?source=rss-210fc7373403------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8376654b694</guid>
            <dc:creator><![CDATA[Rajeshbhai]]></dc:creator>
            <pubDate>Wed, 08 Jan 2025 02:08:09 GMT</pubDate>
            <atom:updated>2025-01-08T02:08:09.601Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding class me swagats hai</p><p>****************************************************✍️writer name rajesh kushwaha**<br>******************************************<br>C++ is a powerful, high-performance, and versatile programming language used in various fields and industries. Below are some key applications of C++:<br>******************************************<br>*******1. System Software********<br>******************************************<br>Development of operating systems (e.g., parts of Windows, Linux).<br>Drivers for hardware interaction.</p><p>******************************************<br>*******2. Game Development********</p><p>Widely used in game engines (e.g., Unreal Engine).</p><p>Provides performance optimization for high-end graphics and real-time processing.</p><p>******************************************<br>******3. Desktop Applications*******</p><p>Development of resource-intensive software like Adobe Photoshop, Autodesk tools, and Microsoft Office.</p><p>******************************************<br>********4. Embedded Systems*******</p><p>Used in programming microcontrollers and embedded devices (e.g., IoT devices, automotive software).<br>******************************************<br>*******5. Web Browsers********</p><p>Backend components of web browsers like Google Chrome and Mozilla Firefox are written in C++ for performance.</p><p>******************************************<br>*******6. Banking and Finance********</p><p>Development of financial systems requiring high performance, such as trading platforms and risk management tools.<br>******************************************<br>*******7. Scientific Computing********</p><p>Simulations, computational biology, and mathematical modeling tools like MATLAB often use C++ for core libraries.</p><p>******************************************<br>****8. High-Performance Applications****</p><p>Real-time applications such as telecom, flight simulation, and robotics.</p><p>Development of tools requiring low-level hardware access or maximum speed.</p><p>******************************************<br>******9. Cloud/Distributed Systems********</p><p>Servers for cloud platforms and distributed systems often leverage C++ for low-latency communication.</p><p>******************************************<br>*******10. Compiler Design*******</p><p>C++ is used to build compilers for other programming languages.</p><p>******************************************<br>**********11. Artificial Intelligence (AI) and Machine Learning (ML)***********</p><p>Libraries like TensorFlow and PyTorch have C++ components for performance-critical tasks.</p><p>******************************************<br>********12. Database Systems*********</p><p>Database engines like MySQL and MongoDB use C++ for their core functionality.</p><p>******************************************<br>******13. Networking**********</p><p>Networked applications, protocols, and tools (e.g., FTP servers, network simulators) are often developed using C++.</p><p>******************************************<br>C++ remains a go-to choice in many domains where performance, control, and efficiency are critical. Its combination of high-level and low-level programming capabilities makes it indispensable in software development.<br>**************************************************✍️writer name rajesh kushwaha**<br>******************************************</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8376654b694" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding class me swagats hai]]></title>
            <link>https://medium.com/@rajeshbhai91718215/coding-class-me-swagats-hai-aee0c43e9ab7?source=rss-210fc7373403------2</link>
            <guid isPermaLink="false">https://medium.com/p/aee0c43e9ab7</guid>
            <dc:creator><![CDATA[Rajeshbhai]]></dc:creator>
            <pubDate>Wed, 18 Dec 2024 00:55:45 GMT</pubDate>
            <atom:updated>2024-12-18T00:55:45.191Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding class me swagats hai</p><p>**************************************************writer name rajesh kushwaha*******</p><p>******************************************</p><p>The &lt;utility&gt; header in C++ is part of the Standard Template Library (STL) and provides utility functions and templates that facilitate programming tasks. Its primary purpose is to provide a collection of generic and lightweight utilities that are widely useful across various programs.<br>******************************************<br>******Key Contents of &lt;utility&gt;:******<br>******************************************<br>*******1. std::pair:*******</p><p>A template class used to store two heterogeneous objects as a single unit.</p><p>********Example:********</p><p>std::pair&lt;int, std::string&gt; myPair(1, &quot;Hello&quot;);</p><p>******************************************<br>*******2. std::make_pair:*******</p><p>A helper function to create a std::pair object without explicitly specifying the types.</p><p>********Example:********</p><p>auto myPair = std::make_pair(1, &quot;Hello&quot;);</p><p>******************************************</p><p>*******3. std::move:********</p><p>A function used to enable the transfer of resources from one object to another (move semantics).</p><p>******Example:*******</p><p>std::string str = &quot;Hello&quot;;<br>std::string movedStr = std::move(str); // Transfers ownership</p><p>******************************************</p><p>********4. std::forward:*********</p><p>Used to forward arguments to another function, preserving their value categories (lvalue or rvalue).<br>******************************************<br>********Example:*********</p><p>template &lt;typename T&gt;<br>void wrapper(T&amp;&amp; arg) {<br> process(std::forward&lt;T&gt;(arg));<br>}<br>******************************************</p><p>********5. std::swap:*********</p><p>Exchanges the values of two objects.<br>******************************************<br>********Example:*******</p><p>int a = 5, b = 10;<br>std::swap(a, b); // Now a = 10, b = 5</p><p>******************************************</p><p>*******6. std::declval:********</p><p>Used in template metaprogramming to construct objects without requiring a definition.</p><p>*******Example:********</p><p>decltype(std::declval&lt;Foo&gt;().bar()) myVar; // Type deduction</p><p>******************************************</p><p>*********7. Relational operators for std::pair:********</p><p>Provides comparison operators (==, &lt;, &lt;=, etc.) for pairs.</p><p>******************************************</p><p>**†*******8. std::in_place and related tags:*****</p><p>Utility tags for in-place construction of objects.</p><p>******************************************</p><p>******Purpose:*********</p><p>1..Convenience: Simplifies common programming patterns like pairing values or forwarding arguments.</p><p>2..Efficiency: Reduces boilerplate code and promotes optimal resource management (e.g., move semantics).</p><p>3..Flexibility: Helps with advanced techniques like perfect forwarding and type deduction.<br>******************************************</p><p>The &lt;utility&gt; header is widely used in modern C++ development due to its versatility in simplifying code and optimizing performance.<br>******************************************<br>*********writer name rajesh kushwaha*****</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aee0c43e9ab7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding class me swagats hai]]></title>
            <link>https://medium.com/@rajeshbhai91718215/coding-class-me-swagats-hai-f5845b96ec80?source=rss-210fc7373403------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5845b96ec80</guid>
            <dc:creator><![CDATA[Rajeshbhai]]></dc:creator>
            <pubDate>Tue, 17 Dec 2024 14:31:10 GMT</pubDate>
            <atom:updated>2024-12-17T14:31:10.975Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding class me swagats hai</p><p>**************************************************writer name rajesh kushwaha*******</p><p>*******************************************</p><p>The &lt;time.h&gt; header file in C provides functions and types for manipulating date and time. It is part of the C Standard Library and is used to work with calendar time, system time, and local time.</p><p>*******************************************</p><p>********Purpose of &lt;time.h&gt;******</p><p>1..To retrieve the current time and date.</p><p>2..To manipulate and format time values.</p><p>3..To perform operations like measuring the time difference between events.</p><p>*******************************************</p><p>******Contents of &lt;time.h&gt;******</p><p>******1. Data Types:*******</p><p>1..time_t: Represents calendar time (seconds since the Unix Epoch, January 1, 1970).</p><p>2..struct tm: Holds broken-down time (year, month, day, hour, minute, second, etc.).</p><p>3..clock_t: Used to represent processor clock time.</p><p>4..size_t: Unsigned integer type for sizes.</p><p>*******************************************</p><p>******2. Functions:******</p><p>*****Time Retrieval:*********</p><p>1..time(time_t *timer): Returns the current calendar time as a time_t value.</p><p>*******************************************</p><p>******Time Conversion:******</p><p>1..localtime(const time_t *timer): Converts calendar time to broken-down local time (returns struct tm).</p><p>2..gmtime(const time_t *timer): Converts calendar time to broken-down UTC time (returns struct tm).</p><p>3..mktime(struct tm *timeptr): Converts broken-down local time to calendar time (time_t).</p><p>*******************************************</p><p>*******Time Formatting:********</p><p>1..strftime(char *str, size_t max, const char *format, const struct tm *timeptr): Formats time into a string based on the specified format.</p><p>*******************************************</p><p>******Processor Time:******</p><p>1..clock(): Returns the processor clock time used by the program.</p><p>******Time Measurement:******</p><p>1..difftime(time_t end, time_t start): Calculates the difference in seconds between two time_t values.</p><p>*******************************************</p><p>*****Sleeping:******</p><p>1..nanosleep(const struct timespec *req, struct timespec *rem): Suspends execution for a specified time (POSIX standard).</p><p>*******************************************</p><p>*****3. Macros:*******</p><p>1..CLOCKS_PER_SEC: Number of clock ticks per second (used with clock()).</p><p>*******************************************</p><p>*****Example Usage******</p><p>#include &lt;stdio.h&gt;</p><p>#include &lt;time.h&gt;</p><p>int main() {</p><p>time_t current_time;</p><p>struct tm *local_time;</p><p>// Get current time</p><p>time(&amp;current_time);</p><p>// Convert to local time</p><p>local_time = localtime(&amp;current_time);</p><p>// Print formatted date and time</p><p>printf(&quot;Current Date and Time: %s&quot;, asctime(local_time));</p><p>return 0;</p><p>}</p><p>******Applications******</p><p>1..Timestamping events in applications.</p><p>2..Measuring performance by calculating execution time.</p><p>3..Creating schedulers or timers in programs.</p><p>*******************************************</p><p>Formatting and displaying date and time for user interfaces.</p><p>*******************************************</p><p>*******writer name rajesh kushwaha*******</p><p>*****************************************</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5845b96ec80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding class me swagats hai]]></title>
            <link>https://medium.com/@rajeshbhai91718215/coding-class-me-swagats-hai-17e1455579ae?source=rss-210fc7373403------2</link>
            <guid isPermaLink="false">https://medium.com/p/17e1455579ae</guid>
            <dc:creator><![CDATA[Rajeshbhai]]></dc:creator>
            <pubDate>Tue, 17 Dec 2024 14:29:43 GMT</pubDate>
            <atom:updated>2024-12-17T14:29:43.006Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding class me swagats hai</p><p>*************************************************writer name rajesh kushwaha*********<br>*******************************************<br>The &lt;fatream.h&gt; header file is part of the C++ Standard Library and provides utilities for working with file-based streams, specifically file input and output operations. It contains classes for reading from and writing to files using the std::fstream, std::ifstream, and std::ofstream classes, which are derived from the base class std::ios.<br>*******************************************<br>******Purpose*******<br>*******************************************<br>***The &lt;fstream&gt; header is used to:******<br>*******************************************<br>1. Handle file input and output in C++.</p><p>2. Provide an object-oriented way to manage files (e.g., opening, reading, writing, and closing files).</p><p>3. Work with both text and binary files.</p><p>*******************************************</p><p>*******Key Contents of &lt;fstream&gt;*******</p><p>*******1. Classes******</p><p>******std::fstream:*******<br>*******************************************<br>Represents both input and output file streams (read and write operations in one object).</p><p>Allows handling file streams for both text and binary modes.<br>*******************************************</p><p>*****std::ifstream:*******</p><p>1..Represents input file streams (for reading files).</p><p>2..Provides methods to read data from files.</p><p>*****std::ofstream:******</p><p>1..Represents output file streams (for writing files).</p><p>2..Provides methods to write data into files.</p><p>-******2. Key Methods*********</p><p>1..The following methods are common in file stream classes:</p><p>2..open(const char filename, std::ios::openmode mode):* Opens a file with a specified mode (e.g., read-only, write-only, append, binary, etc.).</p><p>3..is_open(): Checks if a file stream is successfully opened.</p><p>4..close(): Closes the file associated with the file stream.</p><p>5..eof(): Checks if the end of the file has been reached during read operations.</p><p>6..fail(): Checks if a stream operation failed.</p><p>7..write() / read(): Used for binary file operations to write/read raw data to/from a file.</p><p>8..&lt;&lt; / &gt;&gt; operators: Used for text file operations to write/read formatted data.</p><p>*******************************************</p><p>*****3. Common File Modes*******</p><p>1..Defined in std::ios::openmode enumeration:</p><p>2..std::ios::in: Open for reading.</p><p>3...std::ios::out: Open for writing.</p><p>4..std::ios::binary: Open in binary mode.</p><p>5..std::ios::app: Append mode.</p><p>6..std::ios::trunc: Truncate the file to 0 length if it exists.</p><p>*******************************************</p><p>******Example Code******</p><p>********Text File Example******</p><p>#include &lt;fstream&gt;<br>#include &lt;iostream&gt;</p><p>int main() {<br> // Writing to a file<br> std::ofstream outFile(&quot;example.txt&quot;);<br> if (outFile.is_open()) {<br> outFile &lt;&lt; &quot;Hello, file handling in C++!&quot; &lt;&lt; std::endl;<br> outFile.close();<br> }</p><p>// Reading from a file<br> std::ifstream inFile(&quot;example.txt&quot;);<br> if (inFile.is_open()) {<br> std::string line;<br> while (std::getline(inFile, line)) {<br> std::cout &lt;&lt; line &lt;&lt; std::endl;<br> }<br> inFile.close();<br> }<br> return 0;<br>}</p><p>Binary File Example</p><p>#include &lt;fstream&gt;<br>#include &lt;iostream&gt;</p><p>int main() {<br> // Writing binary data<br> std::ofstream outFile(&quot;example.bin&quot;, std::ios::binary);<br> if (outFile.is_open()) {<br> int number = 42;<br> outFile.write(reinterpret_cast&lt;const char*&gt;(&amp;number), sizeof(number));<br> outFile.close();<br> }</p><p>// Reading binary data<br> std::ifstream inFile(&quot;example.bin&quot;, std::ios::binary);<br> if (inFile.is_open()) {<br> int number;<br> inFile.read(reinterpret_cast&lt;char*&gt;(&amp;number), sizeof(number));<br> std::cout &lt;&lt; &quot;Number read from file: &quot; &lt;&lt; number &lt;&lt; std::endl;<br> inFile.close();<br> }<br> return 0;<br>}<br>***************************************************<br>Summary</p><p>The &lt;fstream&gt; header provides essential tools for file handling in C++, supporting both high-level formatted text operations and low-level binary operations. It is widely used for persistent storage, configuration files, logging, and more.<br>*******************************************<br>*****writer name rajesh kushwaha*********<br>*****************************************</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17e1455579ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding class me swagat hai]]></title>
            <link>https://medium.com/@rajeshbhai91718215/coding-class-me-swagat-hai-60c8d3eab2de?source=rss-210fc7373403------2</link>
            <guid isPermaLink="false">https://medium.com/p/60c8d3eab2de</guid>
            <dc:creator><![CDATA[Rajeshbhai]]></dc:creator>
            <pubDate>Sun, 15 Dec 2024 02:02:37 GMT</pubDate>
            <atom:updated>2024-12-15T02:02:37.335Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding class me swagat hai</p><p>***************************************************writer name rajesh kushwaha******<br>******************************************<br>Dynamic initialization of objects refers to creating and initializing objects at runtime, as opposed to compile-time. This is particularly useful when the values used for initialization are not known beforehand and need to be computed or provided during the program&#39;s execution.<br>******************************************<br>*******Key Characteristics:*******<br>******************************************<br>*******1. Runtime Allocation:**†**** Objects are created in memory during program execution.</p><p>******************************************<br>********2. Flexibility: *********<br>Initialization values can be user input, calculated results, or data retrieved from an external source.</p><p>******************************************<br>*******3. Use of Constructors: ******<br>Often involves calling constructors with parameters to initialize member variables dynamically.</p><p>******************************************</p><p>******Example in Different Languages********<br>******************************************<br>*******C++******<br>******************************************<br>#include &lt;iostream&gt;<br>using namespace std;</p><p>class Example {<br> int value;<br>public:<br> Example(int v) { value = v; }<br> void display() { cout &lt;&lt; &quot;Value: &quot; &lt;&lt; value &lt;&lt; endl; }<br>};</p><p>int main() {<br> int userValue;<br> cout &lt;&lt; &quot;Enter a value: &quot;;<br> cin &gt;&gt; userValue;</p><p>// Dynamically initializing object<br> Example obj(userValue);<br> obj.display();</p><p>return 0;<br>}<br>******************************************<br>*******Java******</p><p>import java.util.Scanner;</p><p>class Example {<br> private int value;</p><p>// Constructor<br> public Example(int value) {<br> this.value = value;<br> }</p><p>public void display() {<br> System.out.println(&quot;Value: &quot; + value);<br> }<br>}</p><p>public class Main {<br> public static void main(String[] args) {<br> Scanner scanner = new Scanner(System.in);</p><p>System.out.print(&quot;Enter a value: &quot;);<br> int userValue = scanner.nextInt();</p><p>// Dynamically initializing object<br> Example obj = new Example(userValue);<br> obj.display();<br> }<br>}<br>******************************************<br>******Python******</p><p>class Example:<br> def __init__(self, value):<br> self.value = value</p><p>def display(self):<br> print(f&quot;Value: {self.value}&quot;)</p><p># Input from the user<br>user_value = int(input(&quot;Enter a value: &quot;))</p><p># Dynamically initializing object<br>obj = Example(user_value)<br>obj.display()</p><p>******C#******</p><p>using System;</p><p>class Example {<br> private int value;</p><p>public Example(int value) {<br> this.value = value;<br> }</p><p>public void Display() {<br> Console.WriteLine($&quot;Value: {value}&quot;);<br> }<br>}</p><p>class Program {<br> static void Main(string[] args) {<br> Console.Write(&quot;Enter a value: &quot;);<br> int userValue = Convert.ToInt32(Console.ReadLine());</p><p>// Dynamically initializing object<br> Example obj = new Example(userValue);<br> obj.Display();<br> }<br>}<br>******************************************<br>*****When to Use Dynamic Initialization*****<br>******************************************<br>1. When data is fetched from a user, file, or database.</p><p>2. When object creation depends on runtime conditions.</p><p>3. When creating objects in memory dynamically, such as in dynamic data structures.<br>******************************************<br>By leveraging dynamic initialization, developers can create more flexible, reusable, and interactive applications.<br>******************************************<br>********writer name rajesh kushwaha******<br>******************************************</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60c8d3eab2de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding class me swagats hai]]></title>
            <link>https://medium.com/@rajeshbhai91718215/coding-class-me-swagats-hai-45921de14cf9?source=rss-210fc7373403------2</link>
            <guid isPermaLink="false">https://medium.com/p/45921de14cf9</guid>
            <dc:creator><![CDATA[Rajeshbhai]]></dc:creator>
            <pubDate>Sat, 14 Dec 2024 11:39:55 GMT</pubDate>
            <atom:updated>2024-12-14T11:39:55.623Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding class me swagats hai</p><p>***************************************************writer name rajesh kushwaha******<br>******************************************</p><p>In object-oriented programming, a class can have multiple constructors, a concept known as constructor overloading. This allows a class to have constructors with different parameter lists, enabling the creation of objects in various ways depending on the provided data.<br>******************************************<br>Key Features of Multiple Constructors:<br>******************************************<br>*****1. Flexibility: *****<br>Supports the initialization of objects with different sets of data.</p><p>******************************************<br>*******2. Overloading: *******<br>Each constructor has a unique parameter signature (number or types of parameters).</p><p>******************************************<br>********3. Default Constructor Compatibility: ********<br>A default constructor can coexist with parameterized constructors.</p><p>******************************************</p><p>*****Example in C++:******</p><p>#include &lt;iostream&gt;<br>using namespace std;</p><p>class Rectangle {<br>private:<br> int length, width;</p><p>public:<br> // Default constructor<br> Rectangle() {<br> length = 0;<br> width = 0;<br> }</p><p>// Parameterized constructor<br> Rectangle(int l, int w) {<br> length = l;<br> width = w;<br> }</p><p>// Constructor with one parameter (square)<br> Rectangle(int side) {<br> length = width = side;<br> }</p><p>int area() {<br> return length * width;<br> }<br>};</p><p>int main() {<br> Rectangle rect1; // Calls default constructor<br> Rectangle rect2(10, 5); // Calls parameterized constructor<br> Rectangle rect3(7); // Calls constructor with one parameter</p><p>cout &lt;&lt; &quot;Area (default): &quot; &lt;&lt; rect1.area() &lt;&lt; endl;<br> cout &lt;&lt; &quot;Area (rect2): &quot; &lt;&lt; rect2.area() &lt;&lt; endl;<br> cout &lt;&lt; &quot;Area (rect3): &quot; &lt;&lt; rect3.area() &lt;&lt; endl;</p><p>return 0;</p><p>*****************************************</p><p>******Example in Java:*******</p><p>class Rectangle {<br> int length, width;</p><p>// Default constructor<br> Rectangle() {<br> length = 0;<br> width = 0;<br> }</p><p>// Parameterized constructor<br> Rectangle(int l, int w) {<br> length = l;<br> width = w;<br> }</p><p>// Constructor with one parameter (square)<br> Rectangle(int side) {<br> length = width = side;<br> }</p><p>int area() {<br> return length * width;<br> }<br>}</p><p>public class Main {<br> public static void main(String[] args) {<br> Rectangle rect1 = new Rectangle(); // Calls default constructor<br> Rectangle rect2 = new Rectangle(10, 5); // Calls parameterized constructor<br> Rectangle rect3 = new Rectangle(7); // Calls constructor with one parameter</p><p>System.out.println(&quot;Area (default): &quot; + rect1.area());<br> System.out.println(&quot;Area (rect2): &quot; + rect2.area());<br> System.out.println(&quot;Area (rect3): &quot; + rect3.area());<br> }<br>}</p><p>******************************************</p><p>Key Rules for Multiple Constructors:<br>******************************************<br>*******1. Unique Signature: ******<br>Each constructor must have a different number or type of parameters.</p><p>******************************************<br>******2. Constructor Chaining: ****** Constructors can call each other using this (in Java) or an initializer list (in C++) to avoid code duplication.<br>******************************************<br>******Example in Java:******</p><p>Rectangle(int side) {<br> this(side, side); // Calls another constructor<br>}</p><p>Example in C++:</p><p>Rectangle(int side) : Rectangle(side, side) {} // Calls another constructor<br>******************************************</p><p>*****Advantages:******</p><p>1. Allows creating objects with varying initializations.</p><p>2. Enhances code readability and maintainability.</p><p>3. Provides flexibility for future changes in object creation.</p><p>******************************************<br>*******Best Practices:********</p><p>Avoid excessive overloading to keep the code clean and understandable.<br>******************************************<br>Use constructor chaining to reduce redundancy in initialization logic.<br>******************************************<br>*******writer name rajesh kushwaha******<br>*****************************************</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45921de14cf9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding classme swagats hai]]></title>
            <link>https://medium.com/@rajeshbhai91718215/coding-classme-swagats-hai-c76e90f7e56a?source=rss-210fc7373403------2</link>
            <guid isPermaLink="false">https://medium.com/p/c76e90f7e56a</guid>
            <dc:creator><![CDATA[Rajeshbhai]]></dc:creator>
            <pubDate>Thu, 12 Dec 2024 08:11:58 GMT</pubDate>
            <atom:updated>2024-12-12T08:11:58.442Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding classme swagats hai</p><p>************************************************writer name rajesh kushwaha*****</p><p>Function overloading in C++ allows multiple functions with the same name but different parameter lists to coexist in the same scope. The compiler differentiates these functions by their number and type of parameters.</p><p>************************************</p><p>Here’s an example to demonstrate function overloading:</p><p>#include &lt;iostream&gt;<br>using namespace std;</p><p>// Function to calculate the square of an integer<br>int calculate(int num) {<br> return num * num;<br>}</p><p>// Function to calculate the square of a double<br>double calculate(double num) {<br> return num * num;<br>}</p><p>// Function to calculate the product of two integers<br>int calculate(int num1, int num2) {<br> return num1 * num2;<br>}</p><p>int main() {<br> cout &lt;&lt; &quot;Square of 5 (int): &quot; &lt;&lt; calculate(5) &lt;&lt; endl; // Calls calculate(int)<br> cout &lt;&lt; &quot;Square of 5.5 (double): &quot; &lt;&lt; calculate(5.5) &lt;&lt; endl; // Calls calculate(double)<br> cout &lt;&lt; &quot;Product of 5 and 6: &quot; &lt;&lt; calculate(5, 6) &lt;&lt; endl; // Calls calculate(int, int)</p><p>return 0;<br>}<br>************************************<br>********Explanation:*****</p><p>1. Single integer parameter: The first calculate function takes an integer and returns its square.</p><p>2. Single double parameter: The second calculate function takes a double and returns its square.</p><p>3. Two integer parameters: The third calculate function takes two integers and returns their product.</p><p>************************************</p><p>******Output:*****</p><p>Square of 5 (int): 25<br>Square of 5.5 (double): 30.25<br>Product of 5 and 6: 30</p><p>*********Key Points:********</p><p>Overloading works because the compiler can distinguish between the functions by their parameter types or the number of parameters.</p><p>Return type alone cannot be used to distinguish overloaded functions. For example, int func() and double func() would result in a compiler error.</p><p>************************************************writer name rajesh kushwaha*****</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c76e90f7e56a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding class me  swagats hai]]></title>
            <link>https://medium.com/@rajeshbhai91718215/coding-class-me-swagats-hai-6d8f481d0ea0?source=rss-210fc7373403------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d8f481d0ea0</guid>
            <dc:creator><![CDATA[Rajeshbhai]]></dc:creator>
            <pubDate>Thu, 12 Dec 2024 07:51:56 GMT</pubDate>
            <atom:updated>2024-12-12T07:51:56.805Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding class me swagats hai</p><p>***********************************************writer name rajesh kushwaha*****</p><p>Here is a simple C++ program to calculate the factorial of a number:<br>*****************************************<br>#include &lt;iostream&gt;<br>using namespace std;</p><p>// Function to calculate factorial<br>unsigned long long factorial(int n) {<br> if (n == 0 || n == 1) {<br> return 1; // Base case: factorial of 0 or 1 is 1<br> }<br> return n * factorial(n - 1); // Recursive case<br>}</p><p>int main() {<br> int num;<br> cout &lt;&lt; &quot;Enter a positive integer: &quot;;<br> cin &gt;&gt; num;</p><p>if (num &lt; 0) {<br> cout &lt;&lt; &quot;Factorial of a negative number doesn&#39;t exist.&quot; &lt;&lt; endl;<br> } else {<br> cout &lt;&lt; &quot;Factorial of &quot; &lt;&lt; num &lt;&lt; &quot; is &quot; &lt;&lt; factorial(num) &lt;&lt; endl;<br> }</p><p>return 0;<br>}</p><p>*******How it works:********</p><p>1. The program prompts the user to enter a positive integer.</p><p>2. It checks if the number is negative. If it is, an error message is displayed.</p><p>3. If the input is valid, it calculates the factorial using a recursive function factorial.</p><p>4. The result is displayed.</p><p>*******Example Output:*****</p><p>Enter a positive integer: 5<br>Factorial of 5 is 120</p><p>You can also use an iterative approach if recursion is not preferred. Let me know if you&#39;d like an example of that!</p><p>************************************************writer name rajesh kushwaha*****</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d8f481d0ea0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding class me swagats hai]]></title>
            <link>https://medium.com/@rajeshbhai91718215/coding-class-me-swagats-hai-b249c2b6c700?source=rss-210fc7373403------2</link>
            <guid isPermaLink="false">https://medium.com/p/b249c2b6c700</guid>
            <dc:creator><![CDATA[Rajeshbhai]]></dc:creator>
            <pubDate>Thu, 12 Dec 2024 07:28:24 GMT</pubDate>
            <atom:updated>2024-12-12T07:28:24.113Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding class me swagats hai</p><p>************************************************writer name rajesh kushwaha*****</p><p>The Tower of Hanoi is a classic recursive problem in which you move disks from one rod to another under specific rules.</p><p>************************************</p><p>******Problem Statement********</p><p>You have three rods (A, B, and C) and disks of different sizes. The goal is to move all the disks from rod A to rod C, following these rules:</p><p>1. Only one disk can be moved at a time.</p><p>2. A disk can only be placed on top of a larger disk or an empty rod.</p><p>3. You can use rod B as an auxiliary.</p><p>************************************</p><p>*********Recursive Approach******</p><p>The solution involves breaking the problem into smaller subproblems:</p><p>1. Move the top disks from rod A to rod B using rod C as auxiliary.</p><p>2. Move the largest disk (nth) from rod A to rod C.</p><p>3. Move the disks from rod B to rod C using rod A as auxiliary.</p><p>*************&quot;*********&quot;*&quot;*&quot;*********</p><p>*******Implementation in C++*****</p><p>Here’s the code for solving the Tower of Hanoi:</p><p>#include &lt;iostream&gt;</p><p>using namespace std;</p><p>// Recursive function to solve Tower of Hanoi</p><p>void towerOfHanoi(int n, char fromRod, char toRod, char auxRod) {</p><p>if (n == 1) { // Base case: Move the last disk directly</p><p>cout &lt;&lt; &quot;Move disk 1 from &quot; &lt;&lt; fromRod &lt;&lt; &quot; to &quot; &lt;&lt; toRod &lt;&lt; endl;</p><p>return;</p><p>}</p><p>// Step 1: Move top (n-1) disks from fromRod to auxRod</p><p>towerOfHanoi(n - 1, fromRod, auxRod, toRod);</p><p>// Step 2: Move the nth disk from fromRod to toRod</p><p>cout &lt;&lt; &quot;Move disk &quot; &lt;&lt; n &lt;&lt; &quot; from &quot; &lt;&lt; fromRod &lt;&lt; &quot; to &quot; &lt;&lt; toRod &lt;&lt; endl;</p><p>// Step 3: Move the (n-1) disks from auxRod to toRod</p><p>towerOfHanoi(n - 1, auxRod, toRod, fromRod);</p><p>}</p><p>int main() {</p><p>int n = 3; // Number of disks</p><p>towerOfHanoi(n, &#39;A&#39;, &#39;C&#39;, &#39;B&#39;); // A: Source, C: Destination, B: Auxiliary</p><p>return 0;</p><p>}</p><p>************************************</p><p>*****Example Output for 3 Disks******</p><p>*****If , the output will be:******</p><p>Move disk 1 from A to C</p><p>Move disk 2 from A to B</p><p>Move disk 1 from C to B</p><p>Move disk 3 from A to C</p><p>Move disk 1 from B to A</p><p>Move disk 2 from B to C</p><p>Move disk 1 from A to C</p><p>************************************</p><p>******Time Complexity*****</p><p>The time complexity is , which simplifies to .</p><p>Explanation of Recursive Calls</p><p>For :</p><p>1. Move 2 disks from A to B (using C as auxiliary).</p><p>Move 1 disk from A to C.</p><p>Move 1 disk from A to B.</p><p>Move 1 disk from C to B.</p><p>2. Move the largest disk (disk 3) from A to C.</p><p>3. Move 2 disks from B to C (using A as auxiliary).</p><p>Move 1 disk from B to A.</p><p>Move 1 disk from B to C.</p><p>Move 1 disk from A to C.</p><p>This recursive structure breaks the problem into manageable parts, solving one smaller problem at a time.</p><p>***********************************&quot;</p><p>******Tips for Understanding******</p><p>1. Start with small values of (e.g., or ).</p><p>2. Visualize the process or use a simulator.</p><p>3. Trace the recursive calls manually to understand how the problem reduces.</p><p>*************************************************writer name rajesh kushwaha****</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b249c2b6c700" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding class me swagats hai]]></title>
            <link>https://medium.com/@rajeshbhai91718215/coding-class-me-swagats-hai-82602c716ddd?source=rss-210fc7373403------2</link>
            <guid isPermaLink="false">https://medium.com/p/82602c716ddd</guid>
            <dc:creator><![CDATA[Rajeshbhai]]></dc:creator>
            <pubDate>Thu, 12 Dec 2024 07:08:55 GMT</pubDate>
            <atom:updated>2024-12-12T07:08:55.330Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding class me swagats hai</p><p>*********************************&quot;*****************writer name rajesh kushwaha******</p><p>Recursion in C++ refers to the process where a function calls itself, either directly or indirectly, to solve a problem. It is often used to solve problems that can be divided into smaller, similar subproblems.</p><p>Structure of a Recursive Function</p><p>A recursive function must have:</p><p>1. Base Case: The condition that stops the recursion.</p><p>2. Recursive Case: The part where the function calls itself.</p><p>Example: Factorial Calculation</p><p>#include &lt;iostream&gt;<br>using namespace std;</p><p>int factorial(int n) {<br> if (n == 0) { // Base case<br> return 1;<br> }<br> return n * factorial(n - 1); // Recursive case<br>}</p><p>int main() {<br> int num = 5;<br> cout &lt;&lt; &quot;Factorial of &quot; &lt;&lt; num &lt;&lt; &quot; is &quot; &lt;&lt; factorial(num) &lt;&lt; endl;<br> return 0;<br>}</p><p>Output: Factorial of 5 is 120</p><p>*********Key Points*****</p><p>1. Base Case is Crucial: Without a base case, the recursion will enter an infinite loop and cause a stack overflow.</p><p>2. Recursive Case Progresses Towards the Base Case: Each recursive call should bring the problem closer to the base case.</p><p>************************************</p><p>*********Types of Recursion*†*****</p><p>*******1. Direct Recursion*******</p><p>A function directly calls itself.</p><p>void directRecursion(int n) {<br> if (n == 0) return;<br> cout &lt;&lt; n &lt;&lt; &quot; &quot;;<br> directRecursion(n - 1);<br>}</p><p>******2. Indirect Recursion*****</p><p>A function calls another function, which then calls the original function.</p><p>void funcB(int n);<br>void funcA(int n) {<br> if (n &lt;= 0) return;<br> cout &lt;&lt; n &lt;&lt; &quot; &quot;;<br> funcB(n - 1);<br>}</p><p>void funcB(int n) {<br> if (n &lt;= 0) return;<br> cout &lt;&lt; n &lt;&lt; &quot; &quot;;<br> funcA(n - 2);<br>}</p><p>************************************</p><p>Common Recursion Examples</p><p>*******1. Fibonacci Sequence********</p><p>#include &lt;iostream&gt;<br>using namespace std;</p><p>int fibonacci(int n) {<br> if (n &lt;= 1) return n; // Base case<br> return fibonacci(n - 1) + fibonacci(n - 2); // Recursive case<br>}</p><p>int main() {<br> int n = 7;<br> cout &lt;&lt; &quot;Fibonacci of &quot; &lt;&lt; n &lt;&lt; &quot; is &quot; &lt;&lt; fibonacci(n) &lt;&lt; endl;<br> return 0;<br>}</p><p>*********2. Sum of Natural Numbers****</p><p>int sum(int n) {<br> if (n == 0) return 0; // Base case<br> return n + sum(n - 1); // Recursive case<br>}</p><p>*******3. Reverse a String*******</p><p>#include &lt;iostream&gt;<br>using namespace std;</p><p>void reverseString(string str, int index) {<br> if (index &lt; 0) return; // Base case<br> cout &lt;&lt; str[index];<br> reverseString(str, index - 1); // Recursive case<br>}</p><p>int main() {<br> string str = &quot;Hello&quot;;<br> reverseString(str, str.length() - 1);<br> return 0;<br>}</p><p>********************************************</p><p>Pros and Cons of Recursion</p><p>*******Advantages:********</p><p>1. Simplifies code for problems like tree traversal, backtracking, etc.</p><p>2. Reduces the need for explicit stack management.</p><p>*******Disadvantages:*****†**</p><p>1. Can lead to stack overflow for large input sizes.</p><p>2. Often less efficient than iterative solutions due to function call overhead.</p><p>3. Uses more memory because of the call stack.</p><p>********************************************</p><p>*******Optimizing Recursion*****</p><p>*******1. Tail Recursion:**********<br> A recursive call where no further computation happens after the function call, making it easier for compilers to optimize.</p><p>void tailRecursion(int n, int result = 1) {<br> if (n == 0) {<br> cout &lt;&lt; result;<br> return;<br> }<br> tailRecursion(n - 1, result * n);<br>}</p><p>*********2. Memoization: ******<br>Store intermediate results to avoid redundant calculations (used in dynamic programming).</p><p>int fibonacciMemo(int n, vector&lt;int&gt;&amp; memo) {<br> if (n &lt;= 1) return n;<br> if (memo[n] != -1) return memo[n];<br> return memo[n] = fibonacciMemo(n - 1, memo) + fibonacciMemo(n - 2, memo);<br>}<br>************************************<br>Recursion is a powerful tool, but it should be used judiciously and optimized where necessary!</p><p>****************************************************writer name rajesh kushwaha*****</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82602c716ddd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>