
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>C++ Archives - TECHNIG</title>
	<atom:link href="https://www.technig.com/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.technig.com/tag/c/</link>
	<description>Gateway for IT Experts and Tech Geeks</description>
	<lastBuildDate>Wed, 13 Sep 2017 06:08:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>

<image>
	<url>https://www.technig.com/wp-content/uploads/2020/04/32x32.png</url>
	<title>C++ Archives - TECHNIG</title>
	<link>https://www.technig.com/tag/c/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">162720667</site>	<item>
		<title>Top 10 Programming Languages that will Rank in 2018</title>
		<link>https://www.technig.com/top-10-programming-languages/</link>
					<comments>https://www.technig.com/top-10-programming-languages/#respond</comments>
		
		<dc:creator><![CDATA[Hujatulla Asghari]]></dc:creator>
		<pubDate>Wed, 13 Sep 2017 06:08:55 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Swift]]></category>
		<category><![CDATA[Top Programming Languages]]></category>
		<guid isPermaLink="false">https://www.technig.com/?p=10593</guid>

					<description><![CDATA[<div style="margin-bottom:20px;"><img width="850" height="419" src="https://www.technig.com/wp-content/uploads/2017/09/Top-10-Programming-languages-2018-Technig.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Top 10 Programming languages 2018 - Technig" decoding="async" fetchpriority="high" srcset="https://www.technig.com/wp-content/uploads/2017/09/Top-10-Programming-languages-2018-Technig.jpg 850w, https://www.technig.com/wp-content/uploads/2017/09/Top-10-Programming-languages-2018-Technig-300x148.jpg 300w, https://www.technig.com/wp-content/uploads/2017/09/Top-10-Programming-languages-2018-Technig-768x379.jpg 768w" sizes="(max-width: 850px) 100vw, 850px" /></div>
<p>If you are a developer, you want to know which programming languages will rank in the next year or future. Specifically, you are curious about your favorite language. This article will list the top 10 programming languages 2018 that will rank. We select these languages based on popularity and usability. Top 10 Programming Languages 2018 [&#8230;]</p>
<p>The post <a href="https://www.technig.com/top-10-programming-languages/">Top 10 Programming Languages that will Rank in 2018</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div style="margin-bottom:20px;"><img width="850" height="419" src="https://www.technig.com/wp-content/uploads/2017/09/Top-10-Programming-languages-2018-Technig.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Top 10 Programming languages 2018 - Technig" decoding="async" loading="lazy" srcset="https://www.technig.com/wp-content/uploads/2017/09/Top-10-Programming-languages-2018-Technig.jpg 850w, https://www.technig.com/wp-content/uploads/2017/09/Top-10-Programming-languages-2018-Technig-300x148.jpg 300w, https://www.technig.com/wp-content/uploads/2017/09/Top-10-Programming-languages-2018-Technig-768x379.jpg 768w" sizes="(max-width: 850px) 100vw, 850px" /></div><p>If you are a developer, you want to know which programming languages will rank in the next year or future. Specifically, you are curious about your favorite language. This article will list the top 10 programming languages 2018 that will rank. We select these languages based on popularity and usability.</p>
<h1>Top 10 Programming Languages 2018</h1>
<p>If you want a quick overview, here is the full list. For more details read the explanation that why these languages are ranking. The underlined text indicates the reason why it&#8217;s ranking and so popular.</p>
<ol>
<li>JavaScript</li>
<li>Python</li>
<li>Java</li>
<li>C++</li>
<li>C</li>
<li>Swift</li>
<li>PHP</li>
<li>C#</li>
<li>Go</li>
<li>R</li>
</ol>
<h2>1. JavaScript</h2>
<figure id="attachment_10640" aria-describedby="caption-attachment-10640" style="width: 490px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/09/JavaScript-top-10-programming-languages-2018-1.png"><img decoding="async" class="size-full wp-image-10640" src="http://3.90.216.52/wp-content/uploads/2017/09/JavaScript-top-10-programming-languages-2018-1.png" alt="JavaScript - top 10 programming languages 2018" width="490" height="185" srcset="https://www.technig.com/wp-content/uploads/2017/09/JavaScript-top-10-programming-languages-2018-1.png 490w, https://www.technig.com/wp-content/uploads/2017/09/JavaScript-top-10-programming-languages-2018-1-300x113.png 300w" sizes="(max-width: 490px) 100vw, 490px" /></a><figcaption id="caption-attachment-10640" class="wp-caption-text">JavaScript &#8211; top 10 programming languages 2018</figcaption></figure>
<p>JavaScript is the number one programming language that will rank in 2018. It&#8217;s a programming language that is run by most modern browsers. It supports object-oriented programming and procedural programming.<span style="text-decoration: underline;"> Knowadays, you can use JavaScript to build mobile app, web app and even desktop applications. ES6 or ES2015 is the latest version of this language. The ES6 features are amazing and blow your mind.</span></p>
<h2>2. Python</h2>
<figure id="attachment_10612" aria-describedby="caption-attachment-10612" style="width: 290px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/09/Python-top-10-programming-languages-2018.png"><img decoding="async" class="wp-image-10612" src="http://3.90.216.52/wp-content/uploads/2017/09/Python-top-10-programming-languages-2018-150x150.png" alt="Python - top 10 programming languages 2018" width="290" height="290" /></a><figcaption id="caption-attachment-10612" class="wp-caption-text">Python &#8211; top 10 programming languages 2018</figcaption></figure>
<p>Python is one of the most powerful programming languages of all the time. It&#8217;s a widely used high-level programming language for general-purpose programming, created by Guido van Rossum. <span style="text-decoration: underline;">The applications like Youtube, Dropbox and Google is based on this language. If you want to work for Google, This language is what you should focus on.</span></p>
<h2>3. Java</h2>
<figure id="attachment_10616" aria-describedby="caption-attachment-10616" style="width: 365px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/09/Java-top-10-programming-languages-2018.png"><img loading="lazy" decoding="async" class="wp-image-10616" src="http://3.90.216.52/wp-content/uploads/2017/09/Java-top-10-programming-languages-2018-150x150.png" alt="Java - top 10 programming languages 2018" width="365" height="365" /></a><figcaption id="caption-attachment-10616" class="wp-caption-text">Java &#8211; top 10 programming languages 2018</figcaption></figure>
<p><span style="text-decoration: underline;"><a href="https://en.wikipedia.org/wiki/Java_(programming_language)">J</a><a href="https://en.wikipedia.org/wiki/Java_(programming_language)">ava&#8217;s </a>p<em>opularity is because of Android. Android is the most popular mobile OS and open-source</em>.</span> Java is a programming language and computing platform first released by Sun Microsystems in 1995. It&#8217;s a general-purpose programming language that is concurrent, class-based, object-oriented and specifically designed to have as few implementation dependencies as possible.</p>
<h2>4. C++</h2>
<figure id="attachment_10617" aria-describedby="caption-attachment-10617" style="width: 298px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/09/CPP-top-10-programming-languages-2018.png"><img loading="lazy" decoding="async" class="wp-image-10617" src="http://3.90.216.52/wp-content/uploads/2017/09/CPP-top-10-programming-languages-2018-150x150.png" alt="CPP - top 10 programming languages 2018" width="298" height="298" /></a><figcaption id="caption-attachment-10617" class="wp-caption-text">CPP &#8211; top 10 programming languages 2018</figcaption></figure>
<p><span style="text-decoration: underline;">Most other top</span><span style="text-decoration: underline;"> program</span><span style="text-decoration: underline;">ming</span><span style="text-decoration: underline;"> languages are based on C++. They have copied the style and structure from C++. For instance, Java, C#, JavaScript and more.</span><em> </em>C++ is a general-purpose object-oriented programming (OOP) language, developed by Bjarne Stroustrup. You can use this powerful language to build applications that run on CPU, build mobile apps, games, and desktop application.</p>
<h2>5. C</h2>
<figure id="attachment_10622" aria-describedby="caption-attachment-10622" style="width: 274px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/09/C-top-10-programming-languages-2018.png"><img loading="lazy" decoding="async" class="wp-image-10622" src="http://3.90.216.52/wp-content/uploads/2017/09/C-top-10-programming-languages-2018-150x150.png" alt="C - top 10 programming languages 2018" width="274" height="274" /></a><figcaption id="caption-attachment-10622" class="wp-caption-text">C &#8211;  programming languages 2018</figcaption></figure>
<p><span style="text-decoration: underline;">C is taught still in most popular universities in the world. It&#8217;s not a high-level programming language, but people learn it because it makes learning other languages easier. High-level languages like Java, C++, C# are almost similar. It&#8217;s like the older version of C++.</span> This language is used a lot in embedded hardware programming where resources are scarce. Linux kernel is written in C.</p>
<h2>6. Swift</h2>
<figure id="attachment_10625" aria-describedby="caption-attachment-10625" style="width: 278px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/09/swift-programming-languages-2018.png"><img loading="lazy" decoding="async" class="wp-image-10625" src="http://3.90.216.52/wp-content/uploads/2017/09/swift-programming-languages-2018-150x150.png" alt="swift programming languages 2018" width="278" height="278" /></a><figcaption id="caption-attachment-10625" class="wp-caption-text">Swift programming languages 2018</figcaption></figure>
<p><span style="text-decoration: underline;">Apple is by far one of the top companies in technology. Swift is the primary language for macOS, iOS, </span>watchOS<span style="text-decoration: underline;">, and </span>tvOS<span style="text-decoration: underline;">.</span> It&#8217;s  is a general-purpose, multi-paradigm, compiled programming language developed by Apple Inc.</p>
<h2>7. PHP</h2>
<figure id="attachment_10627" aria-describedby="caption-attachment-10627" style="width: 273px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/09/PHP-programming-languages-2018.png"><img loading="lazy" decoding="async" class="wp-image-10627" src="http://3.90.216.52/wp-content/uploads/2017/09/PHP-programming-languages-2018.png" alt="PHP programming languages 2018" width="273" height="158" srcset="https://www.technig.com/wp-content/uploads/2017/09/PHP-programming-languages-2018.png 742w, https://www.technig.com/wp-content/uploads/2017/09/PHP-programming-languages-2018-300x174.png 300w" sizes="(max-width: 273px) 100vw, 273px" /></a><figcaption id="caption-attachment-10627" class="wp-caption-text">PHP programming languages</figcaption></figure>
<p><span style="text-decoration: underline;">Becuase web programming is popular category among other desktops, mobile, and CPU, PHP remains the most popular server side programming language.</span> It&#8217;s a general-purpose scripting language that is especially suited to server-side web development, in which case PHP runs on a web server. The application like WordPress, Joomla, Drupal, and Facebook is written in PHP.</p>
<h2>8. C#</h2>
<figure id="attachment_10629" aria-describedby="caption-attachment-10629" style="width: 244px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/09/C-sharp-programming-languages-2018.png"><img loading="lazy" decoding="async" class="wp-image-10629" src="http://3.90.216.52/wp-content/uploads/2017/09/C-sharp-programming-languages-2018-150x150.png" alt="C sharp programming languages 2018" width="244" height="244" srcset="https://www.technig.com/wp-content/uploads/2017/09/C-sharp-programming-languages-2018-150x150.png 150w, https://www.technig.com/wp-content/uploads/2017/09/C-sharp-programming-languages-2018.png 256w" sizes="(max-width: 244px) 100vw, 244px" /></a><figcaption id="caption-attachment-10629" class="wp-caption-text">C sharp programming languages</figcaption></figure>
<p><span style="text-decoration: underline;">Microsoft, of course, the biggest company in the technology category. Their primary language is C#. It&#8217;s used for developing desktop, mobile, and games in Unity.</span> It&#8217;s a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines.</p>
<h2>9. Go</h2>
<figure id="attachment_10631" aria-describedby="caption-attachment-10631" style="width: 200px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/09/Go-programming-languages-2018.png"><img loading="lazy" decoding="async" class="wp-image-10631" src="http://3.90.216.52/wp-content/uploads/2017/09/Go-programming-languages-2018-150x150.png" alt="Go programming languages 2018" width="200" height="200" /></a><figcaption id="caption-attachment-10631" class="wp-caption-text">Go programming languages</figcaption></figure>
<p>Go (often referred to as golang) is a free and open source programming language created at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. It’s compiled and has features such as garbage collection, memory safety, and limited structural typing.<span style="text-decoration: underline;"> Go is good for Stand-alone command-line apps or scripts Network and Web servers. It&#8217;s not good for desktop, system-level </span>programming<span style="text-decoration: underline;">, and  GUI-based apps</span></p>
<h2>10. R</h2>
<figure id="attachment_10633" aria-describedby="caption-attachment-10633" style="width: 225px" class="wp-caption aligncenter"><a href="http://3.90.216.52/wp-content/uploads/2017/09/r-programming-languages-2018.png"><img loading="lazy" decoding="async" class="wp-image-10633" src="http://3.90.216.52/wp-content/uploads/2017/09/r-programming-languages-2018-150x150.png" alt="r programming languages 2018" width="225" height="225" /></a><figcaption id="caption-attachment-10633" class="wp-caption-text">R programming languages</figcaption></figure>
<p>R is a programming language and software environment for statistical analysis, graphics representation, and reporting.<span style="text-decoration: underline;"> R is a very flexible tool for doing a mathematical &amp; statistical analysis. If you are dealing with big data, R is the language you must use. It&#8217;s easily extendable via packages. </span></p>
<h2>Conclusion</h2>
<p>There we are. It was the list of top 10 programming languages. If you have any question or suggestion, feel free to share with us in the comment below</p>
<p>The post <a href="https://www.technig.com/top-10-programming-languages/">Top 10 Programming Languages that will Rank in 2018</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.technig.com/top-10-programming-languages/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">10593</post-id>	</item>
		<item>
		<title>Repetition (Looping) Control Structures in C++</title>
		<link>https://www.technig.com/repetition-looping-control-structures/</link>
					<comments>https://www.technig.com/repetition-looping-control-structures/#respond</comments>
		
		<dc:creator><![CDATA[Raza Bayani]]></dc:creator>
		<pubDate>Fri, 09 Sep 2016 05:15:32 +0000</pubDate>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Control Structure]]></category>
		<category><![CDATA[for loop]]></category>
		<category><![CDATA[while loop]]></category>
		<guid isPermaLink="false">https://www.technig.com/?p=8213</guid>

					<description><![CDATA[<div style="margin-bottom:20px;"></div>
<p>In programming languages &#8211; while coding a program, sometimes it is necessary to repeat a set of statements several times (Looping Control Structures ). A way to repeat statements is to type the same statements in the program over and over. For example, if you want to repeat some statements 100 times, you type the same statements [&#8230;]</p>
<p>The post <a href="https://www.technig.com/repetition-looping-control-structures/">Repetition (Looping) Control Structures in C++</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div style="margin-bottom:20px;"></div><p>In programming languages &#8211; while coding a program, sometimes it is necessary to repeat a set of statements several times (Looping Control Structures ). A way to repeat statements is to type the same statements in the program over and over. For example, if you want to repeat some statements 100 times, you type the same statements 100 times in the program. However, this solution of repeating statements is impractical, if not impossible. Fortunately, there is a better way to repeat a set of statements.</p>
<p>As noted earlier, C++ has three repetition, or looping control structures that allow you to repeat a set of statements until certain conditions are met.</p>
<p><strong>Note</strong>: The variable that controls the loop is called <strong>loop control variable (LCV)</strong></p>
<h1><span style="color: #3366ff;"><b><i>While </i></b></span><b>Looping Control Structures</b></h1>
<p>The first loop that we’re going to discuss about is <strong>while</strong> loop. The general form of <strong>while</strong> loop is:</p>
<pre class="lang:default decode:true ">while (expression)
      statement
</pre>
<p>&nbsp;</p>
<p>In C++, <em><span style="color: #3366ff;">while</span> </em>is a reserved word. Of course, the statement can be either a simple or compound statement. The expression acts as a decision maker and is usually a logical expression. The statement is called the body of the loop. Note that the parentheses around the expression are part of the syntax.</p>
<figure id="attachment_8214" aria-describedby="caption-attachment-8214" style="width: 800px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-8214" src="https://www.technig.com/wp-content/uploads/2016/09/while-1024x563.jpg" alt="While Loop" width="800" height="440" /><figcaption id="caption-attachment-8214" class="wp-caption-text">while loop &#8211; Looping Control Structures</figcaption></figure>
<pre class="lang:default decode:true ">#include &lt;iostream&gt;
using namespace std;
int main()
{
   int X = 0; 			        //Line 1
  while (x &lt;= 20) 		        //Line 2
       {
       cout &lt;&lt; x &lt;&lt; " "; 		//Line 3
        x = x + 5;			 //Line 4
       }

return 0;
</pre>
<p>In <span style="color: #339966;">Line 1</span>, the variable <strong>x</strong> is set to <strong>0</strong>. The <strong>expression</strong> in the <span style="color: #3366ff;">while</span> statement (in <span style="color: #339966;">Line 2</span>), <strong>x &lt;</strong>= 20, is evaluated. Because the expression <strong>x &lt;</strong>= 20 evaluates to<span style="color: #3366ff;"> true</span>, the body of the <span style="color: #3366ff;">while</span> loop executes next. The body of the <span style="color: #3366ff;">while </span>loop consists of the statements in <span style="color: #339966;">Lines 3 and 4</span>. The statement in Line 3 outputs the value of <strong>x</strong>, which is <strong>0</strong>. The statement in<span style="color: #339966;"> Line 4</span> changes the value of <strong>x</strong> to <strong>5</strong>. After executing the statements in<span style="color: #339966;"> Lines 3 and 4</span>, the <strong>expression</strong> in the <span style="color: #3366ff;">while</span> loop (<span style="color: #339966;">Line 2</span>) is evaluated again. Because <strong>x</strong> is <strong>5</strong>, the expression <strong>x &lt;</strong>= 20 evaluates to<span style="color: #3366ff;"> true</span> and the body of the <span style="color: #3366ff;">while</span> loop executes again. This process of evaluating the <strong>expression</strong> and executing the body of the <span style="color: #3366ff;">while</span> loop continues until the <strong>expression</strong>, <strong>x &lt;</strong>= 20 (in <span style="color: #339966;">Line 2</span>), no longer evaluates to <span style="color: #3366ff;">true</span>.</p>
<p><a href="https://www.technig.com/wp-content/uploads/2016/09/whileex.jpg"><img decoding="async" class="size-full wp-image-8215" src="https://www.technig.com/wp-content/uploads/2016/09/whileex.jpg" alt="&quot;&lt;yoastmark" /></a></p>
<p>Kinds of <strong><em>while</em></strong> loops are: counter-controlled, flag-controlled, sentinel-controlled, EOF-controlled <strong><em>while</em> </strong>loops and etc.</p>
<p>&nbsp;</p>
<h1><span style="color: #3366ff;"><b><i>for</i> </b></span><b><span style="color: windowtext;">Repetition (Looping) Structure</span></b></h1>
<p>The general form of <strong><em>for </em></strong>loop is:</p>
<pre class="lang:default decode:true">for (initial statement; loop condition; update statement)
      statement
</pre>
<p>The <strong>initial statement</strong>, <strong>loop condition</strong>, and <strong>update statement</strong> (called<span style="color: #3366ff;"> <em>for</em></span> loop control statements) enclosed within the parentheses control the body (<strong>statement</strong>) of the <span style="color: #3366ff;"><em>for</em></span> statement.</p>
<figure id="attachment_8216" aria-describedby="caption-attachment-8216" style="width: 1265px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/09/For.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-8216" src="https://www.technig.com/wp-content/uploads/2016/09/For.jpg" alt="For Loop" width="1265" height="716" /></a><figcaption id="caption-attachment-8216" class="wp-caption-text">For Loop</figcaption></figure>
<p>The <span style="color: #3366ff;">for</span> loop executes as follows:</p>
<ol>
<li>The <strong>initial statement</strong> executes.</li>
<li>The <strong>loop condition</strong> is evaluated. If the <strong>loop condition</strong> evaluates to <span style="color: #3366ff;">true</span>:
<ol>
<li>Execute the <span style="color: #3366ff;">for</span> loop <strong>statement</strong>.</li>
<li>Execute the <strong>update statement</strong> (the third expression in the parentheses).</li>
</ol>
</li>
<li>Repeat Step 2 until the loop condition evaluates to <span style="color: #3366ff;">false</span>.</li>
</ol>
<p>The <strong>initial statement</strong> usually initializes a variable (called the <span style="color: #3366ff;">for </span><strong>loop control</strong>, or <span style="color: #3366ff;">for</span> <strong>indexed</strong>, variable).</p>
<p>In C++, <span style="color: #3366ff;"><strong><em>for</em></strong> </span>is a reserved word.</p>
<p>Concentrate on the example bellow:</p>
<pre class="lang:default decode:true">#include &lt;iostream&gt;
using namespace std;
int main()
{
  int x;
  for (x = 0; x &lt; 10 ; x++)
    {  
     cout &lt;&lt; x &lt;&lt; " ";
     }
cout &lt;&lt; endl;

return 0;
}
</pre>
<p>The <strong>initial statement</strong>, <strong>x = 0;</strong>, initializes the <span style="color: #3366ff;">int</span> variable <strong>x</strong> to <strong>0</strong>. Next, the loop condition, <strong>x&lt;10</strong>, is evaluated. Because <strong>0&lt;</strong>10 is <span style="color: #3366ff;">true</span>, the print statement executes and outputs 0. The <strong>update statement</strong>, <strong>x++</strong>, then executes, which sets the value of <strong>x</strong> to <strong>1</strong>. Once again, the <strong>loop condition</strong> is evaluated, which is still <span style="color: #3366ff;">true</span>, and so on. When <strong>x</strong> becomes <strong>10</strong>, the <strong>loop condition</strong> evaluates to <span style="color: #3366ff;">false</span>, the <span style="color: #3366ff;">for</span> loop terminates, and the statement following the <span style="color: #3366ff;">for</span> loop executes.</p>
<figure id="attachment_8217" aria-describedby="caption-attachment-8217" style="width: 373px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2016/09/forex.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-8217" src="https://www.technig.com/wp-content/uploads/2016/09/forex.jpg" alt="For Control Structure" width="373" height="241" /></a><figcaption id="caption-attachment-8217" class="wp-caption-text">For Loop Example</figcaption></figure>
<h1><span style="color: #3366ff;"><b><i>do…while</i> </b></span><b><span style="color: windowtext;">Repetition (Looping) Structure</span></b></h1>
<p>This section describes the third type of looping or repetition structure, called a <span style="color: #3366ff;">do&#8230;while</span> loop. The general form of a<span style="color: #3366ff;"> do&#8230;while</span> statement is as follows:</p>
<pre class="lang:default decode:true ">do
       statement
while (expression);
</pre>
<figure id="attachment_8218" aria-describedby="caption-attachment-8218" style="width: 700px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-8218" src="https://www.technig.com/wp-content/uploads/2016/09/Do-while.jpg" alt="Repetition" width="700" height="525" /><figcaption id="caption-attachment-8218" class="wp-caption-text">do-while Loop</figcaption></figure>
<p>The <strong>statement</strong> executes first, and then the <strong>expression</strong> is evaluated. If the <strong>expression</strong> evaluates to <span style="color: #3366ff;">true</span>, the <strong>statement</strong> executes again. As long as the <strong>expression</strong> in a <span style="color: #3366ff;">do&#8230;while</span> statement is <span style="color: #3366ff;">true</span>, the <strong>statement</strong> executes. To avoid an infinite loop, you must, once again, make sure that the loop body contains a statement that ultimately makes the <strong>expression</strong> <span style="color: #3366ff;">false</span> and assures that it exits properly.</p>
<pre class="lang:default decode:true">#include &lt;iostream&gt;
using namespace std;
int main()
{
  x = 0;
  do {
      cout &lt;&lt; x &lt;&lt; " ";
      x = x + 5;
     }while (x &lt;= 20);
return 0;
}
</pre>
<p>The output of the <strong><em>code</em></strong> is:</p>
<p><span style="background-color: #333333; color: #ffffff;"><strong>0  5  10  15  20</strong></span></p>
<p>After 20 output, the statement:</p>
<p>x = x +5;</p>
<p>changes the value of <strong>x</strong> to <strong>25</strong> and so <strong>x &lt;</strong>=20 becomes <span style="color: #3366ff;">false</span>, which halts the loop.</p>
<ul style="list-style-type: disc;">
<li>In a <span style="color: #3366ff;">while</span> and <span style="color: #3366ff;">for</span> loop, the loop condition is evaluated before executing the body of the loop. Therefore, <span style="color: #3366ff;">while </span>and <span style="color: #3366ff;">for</span> loops are called <strong>pretest</strong> loops. On the other hand, the loop condition in a <span style="color: #3366ff;">do&#8230;while</span> loop is evaluated after executing the body of the loop. Therefore, <span style="color: #3366ff;">do&#8230;while</span> loops are called <b>post-test</b> loops. Because the <span style="color: #3366ff;">while</span> and <span style="color: #3366ff;">for</span> loops both have entry conditions, these loops may never activate. The <span style="color: #3366ff;">do&#8230;while</span> loop, on the other hand, has an exit condition and therefore always executes the statement at least once. Looping Control Structures</li>
</ul>
<p>&#8220;The end of Looping Control Structures in C++.</p>
<p>The post <a href="https://www.technig.com/repetition-looping-control-structures/">Repetition (Looping) Control Structures in C++</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.technig.com/repetition-looping-control-structures/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8213</post-id>	</item>
	</channel>
</rss>
