<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bilal Sadiq</title>
    <description>The latest articles on DEV Community by Bilal Sadiq (@bilalsadiq).</description>
    <link>https://dev.to/bilalsadiq</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1219148%2F0bae1028-d165-43fb-ac67-44a019c192a3.JPG</url>
      <title>DEV Community: Bilal Sadiq</title>
      <link>https://dev.to/bilalsadiq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bilalsadiq"/>
    <language>en</language>
    <item>
      <title>#2 Understanding Variables, Input and Output: C++ and DSA</title>
      <dc:creator>Bilal Sadiq</dc:creator>
      <pubDate>Thu, 07 Dec 2023 03:30:48 +0000</pubDate>
      <link>https://dev.to/bilalsadiq/2-understanding-variables-input-and-output-c-and-dsa-4fl5</link>
      <guid>https://dev.to/bilalsadiq/2-understanding-variables-input-and-output-c-and-dsa-4fl5</guid>
      <description>&lt;p&gt;Last blog we studied the introduction to C++. In this blog post, we'll be studying about variables, how to take input from the user and how to dispaly the output and how they form the building blocks of C++ progrms.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are variables?
&lt;/h2&gt;

&lt;p&gt;Variables are conainers that hold data in a program. they act as placeholders for storing information that can be manipulated and used through out the program's execution. In C++, variables must be declared beforethey are used. A declaration specifies the data type of the variable and the name of the variable.&lt;br&gt;
Syntax and examples for variable declaration: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BhiKv75W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4f6bfmxv63jx3r89lmw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BhiKv75W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4f6bfmxv63jx3r89lmw.png" alt="Image description" width="721" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the variables are declared you can assign values to it using assignment operator "=":&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X1ZyiXFJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ox7wv1ncskcbfptbl9c2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X1ZyiXFJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ox7wv1ncskcbfptbl9c2.png" alt="Image description" width="800" height="144"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Beside assigning values to the variables manually, one can take them as input from the user, which is discussed below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Input in C++:
&lt;/h2&gt;

&lt;p&gt;Getting input from the user is a basic requirement in many programs. This can be done using "&lt;em&gt;&lt;strong&gt;cin&lt;/strong&gt;&lt;/em&gt;" stream available in C++.&lt;br&gt;
To get input from the user you need to include the header file "&lt;strong&gt;&lt;em&gt;isotream&lt;/em&gt;&lt;/strong&gt;" in your program as shown below :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--torTJFIG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zz0nnki1kb7ul9934u25.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--torTJFIG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zz0nnki1kb7ul9934u25.png" alt="Image description" width="439" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example of taking input using "&lt;em&gt;&lt;strong&gt;cin&lt;/strong&gt;&lt;/em&gt;" stream :&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E4g2oSpK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/72nmkl0ea4gphocawwbb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E4g2oSpK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/72nmkl0ea4gphocawwbb.png" alt="Image description" width="800" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will show the Output as:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mLZKGSuQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wwiriyp08piu8kunaic.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mLZKGSuQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wwiriyp08piu8kunaic.png" alt="Image description" width="675" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, the program prompts the user to enter marks, reads the input using "&lt;em&gt;&lt;strong&gt;cin&lt;/strong&gt;&lt;/em&gt;", and then displays the entered value using "&lt;strong&gt;&lt;em&gt;cout&lt;/em&gt;&lt;/strong&gt;".&lt;/p&gt;

&lt;h2&gt;
  
  
  Output in C++:
&lt;/h2&gt;

&lt;p&gt;Output in C++ is achieved using the cout stream. It is used to display information to the console.&lt;/p&gt;

&lt;p&gt;Example demostrating Output in C++:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KzMRvJ2Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gxm8coo92hwpyqwzr0ca.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KzMRvJ2Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gxm8coo92hwpyqwzr0ca.png" alt="Image description" width="800" height="231"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Output from the above code:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E5LAxN0K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3gwk4zhgvk3jalcm0y4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E5LAxN0K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3gwk4zhgvk3jalcm0y4.png" alt="Image description" width="734" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, the program outputs the values of variables &lt;em&gt;marks&lt;/em&gt;, &lt;em&gt;cgpa&lt;/em&gt;, and &lt;em&gt;grade&lt;/em&gt; to the console.&lt;/p&gt;

&lt;p&gt;This was all for today. Next we will be seeing the Operators in C++.&lt;br&gt;
Happy Coding! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>#1 Introduction: C++ and DSA</title>
      <dc:creator>Bilal Sadiq</dc:creator>
      <pubDate>Fri, 01 Dec 2023 03:02:21 +0000</pubDate>
      <link>https://dev.to/bilalsadiq/1-introduction-c-and-dsa-28dc</link>
      <guid>https://dev.to/bilalsadiq/1-introduction-c-and-dsa-28dc</guid>
      <description>&lt;p&gt;Welcome to the exciting world of C++ programming! Whether you're a coding enthusiast or a newcomer to the realm of programming languages, C++ is a versatile and powerful language that has stood the test of time. In this blog post, we'll embark on a journey to explore the basics of C++, its history, and why it continues to be a go-to language for developers around the globe.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is C++?
&lt;/h2&gt;

&lt;p&gt;C++ is a general-purpose programming language that was created as an extension of the C programming language. Developed by Bjarne Stroustrup in the early 1980s, C++ was designed with the goal of adding object-oriented programming features to C, without sacrificing the efficiency and low-level access that C provided.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features of C++
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Object Oriented Programming (OOP) :&lt;/strong&gt;&lt;br&gt;
   C++ supports the core principles of OOP, including &lt;br&gt;
   encapsulation, inheritance, and polymorphism. These features &lt;br&gt;
   allow developers to organize and structure their code in a &lt;br&gt;
   modular and reusable way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Efficiency :&lt;/strong&gt;&lt;br&gt;
     C++ provides low-level access to memory, making it suitable &lt;br&gt;
     for system-level programming and resource-constrained &lt;br&gt;
     environments. This level of control over memory makes C++ a &lt;br&gt;
     preferred choice for performance-critical applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Standard Template Library :&lt;/strong&gt;&lt;br&gt;
     The STL is a treasure trove of pre-built classes and &lt;br&gt;
     functions that expedite development by providing generic &lt;br&gt;
     implementations of common algorithms and data structures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Portability :&lt;/strong&gt;&lt;br&gt;
     C++ programs can be compiled to run on different platforms &lt;br&gt;
     without modification. This portability makes it an excellent &lt;br&gt;
     choice for developing cross-platform applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with C++
&lt;/h2&gt;

&lt;p&gt;To start coding in C++, you'll need a compiler and an integrted &lt;br&gt;
   development environment. We'll be using Microsoft Visual &lt;br&gt;
   Studio Code.&lt;br&gt;
   You can download the VS Code from google by simply typing VS &lt;br&gt;
   Code download and by clicking the first link that appears after &lt;br&gt;
   search.&lt;br&gt;&lt;br&gt;
   We'll be writing the first "Hello World!" program.&lt;br&gt;
   You need to create a file with extension .cpp and write the &lt;br&gt;
   following code :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2FsoAPSF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5deb8u0zm9smhu6iai0i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2FsoAPSF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5deb8u0zm9smhu6iai0i.png" alt="Image description" width="800" height="206"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After Writing the above code just simply hit run button on top &lt;br&gt;
   right corner and you will see the output as: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XzwTaIcG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ztulrnjetdoosf8x066w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XzwTaIcG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ztulrnjetdoosf8x066w.png" alt="Image description" width="800" height="68"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congragulations! you have written your first program in C++.&lt;/p&gt;

&lt;h2&gt;
  
  
  Now let's talk about the program and it's structure :
&lt;/h2&gt;

&lt;p&gt;The "#include using namespace std;" is the header &lt;br&gt;
   file you need to include in every C++ program.&lt;br&gt;
   Next is the function int main(), this is the main function, you &lt;br&gt;
   need to write your code in this main function. &lt;br&gt;
   We'll be discussing more about functions later.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br&gt;
   Happy coding!&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>dsa</category>
      <category>programming</category>
      <category>intro</category>
    </item>
  </channel>
</rss>
