<?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++ if else | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/c-if-else/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 10 Dec 2022 04:45:32 +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>C++ If Else</title>
		<link>https://studentprojects.in/software-development/cpp/c-tutorials-cpp/c-if-else/</link>
					<comments>https://studentprojects.in/software-development/cpp/c-tutorials-cpp/c-if-else/#respond</comments>
		
		<dc:creator><![CDATA[Shubhajna Rai]]></dc:creator>
		<pubDate>Thu, 15 Dec 2022 08:05:00 +0000</pubDate>
				<category><![CDATA[C++ Tutorials]]></category>
		<category><![CDATA[Syntax]]></category>
		<category><![CDATA[C++ if else]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9837</guid>

					<description><![CDATA[<p>A selection structure is implemented using if-else expressions. The decision control instruction is implemented in C++ using the if keyword, just like in any other programming language. The if statement&#8217;s condition is always encased in a pair of parentheses. The set of statements that follow the if statement will be executed if the condition is</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/c-tutorials-cpp/c-if-else/">C++ If Else</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>A selection structure is implemented using if-else expressions. The decision control instruction is implemented in C++ using the if keyword, just like in any other programming language.</p>



<p>The if statement&#8217;s condition is always encased in a pair of parentheses. The set of statements that follow the if statement will be executed if the condition is met. Additionally, the statement will not be executed if the condition evaluates to false; instead, the programme will skip the enclosing portion of code.</p>



<p>Relational operators are used to define an expression in if statements. If the expression after the if evaluates to true, the statement contained in the if block will be carried out. However, if the if block is followed by an else block, a sequence of statements in the else block will be executed when the if block&#8217;s condition is false.</p>



<p>Syntax:</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">if ( condition ){
statements;}
 else {
statements;}
</code></pre>



<p>Example:</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">#include &lt;iostream&gt;
using namespace std;
 
int main()
{
    int age;
    cout &lt;&lt; "Enter a number: ";
    cin &gt;&gt; age;
    if (age &gt;= 50)
    {
        cout &lt;&lt; "Input number is greater than 50!" &lt;&lt; endl;
    }
    else if (age == 50)
    {
        cout &lt;&lt; "Input number is equal to 50!" &lt;&lt; endl;
    }
    else
    {
        cout &lt;&lt; "Input number is less than 50!" &lt;&lt; endl;
    }
}
</code></pre>



<p>Input:</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">Enter a number: 53</code></pre>



<p>Output:</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">Input number is greater than 50!</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/c-tutorials-cpp/c-if-else/">C++ If Else</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/c-tutorials-cpp/c-if-else/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
