<?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>initialise counter | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/initialise-counter/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Thu, 29 Dec 2022 13:48:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>For Loop in C++</title>
		<link>https://studentprojects.in/software-development/cpp/for-loop-in-c/</link>
					<comments>https://studentprojects.in/software-development/cpp/for-loop-in-c/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Wed, 28 Dec 2022 12:40:10 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[For loop in c++]]></category>
		<category><![CDATA[initialise counter]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=10043</guid>

					<description><![CDATA[<p>A for loop is a repetition control structure that allows us to design a loop that will execute a given number of times in an efficient manner. The for-loop statement is quite specific. When we already know how many iterations of that particular piece of code we want to run, we use a for loop.</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/for-loop-in-c/">For Loop in C++</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>A for loop is a repetition control structure that allows us to design a loop that will execute a given number of times in an efficient manner. The for-loop statement is quite specific. When we already know how many iterations of that particular piece of code we want to run, we use a for loop. When we don&#8217;t know how many iterations to do, we use a while loop, which is covered next.</p>



<p>The syntax of a for loop in C++ programming is as follows.</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">for (initialise counter; test counter; increment / decrement counter)
{
    //set of statements
}</code></pre>



<p>Here,</p>



<ul>
<li>Initialise counter: This will set the loop counter value to zero. In most cases, i=0.</li>



<li>test counter: This is the test condition; if true, the loop continues; otherwise, the loop ends.</li>



<li>Counter increment/decrement: Increasing or decreasing the counter.</li>



<li>Collection of statements: The body, or executable section, of the for loop, or the set of statements that must be repeated.
<ul>
<li></li>
</ul>
</li>
</ul>



<p>One illustration of how a for loop works is shown below.</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">#include &lt;iostream&gt;
using namespace std;
 
int main()
{
    int num = 10;
    int i;
    for (i = 0; i &lt; num; i++)
    {
        cout &lt;&lt; i &lt;&lt; " ";
    }
    return 0;
}
</code></pre>



<p>Output:</p>



<p>0 1 2 3 4 5 6 7 8 9</p>



<p>The initialization expression will first set the loop variables. When the loop begins, the statement i=0 is executed once. The condition I num is then tested. If the condition is met, the statements within the loop&#8217;s body are performed. After the statements in the body are executed, control of the programme is handed to the variable I being increased by one. The expression i++ alters the variables in the loop. The condition I num is evaluated iteratively. When I ultimately becomes bigger than num, the for loop ends, rendering the condition i&lt;num false</p><p>The post <a href="https://studentprojects.in/software-development/cpp/for-loop-in-c/">For Loop in C++</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/for-loop-in-c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
