Introduction to Conditions in C++ Programing Language

 Contingent Explanation in C++





C++ Programming Language upholds the sensible circumstances from math:


  • u is not exactly v: ( u < v )
  • u is not exactly or comparable to v: ( u <= v )
  • u is bigger than v: ( u > v )
  • u is bigger than or comparable to v: ( u >= v )
  • u is comparable to v: ( u == v )
  • u isn't comparable to v: ( u != v )

We can use these circumstances to perform different activities for different choices.


Contingent Proclamations in C++ Programing Language:

  • Use if proclamation to decide a block of code to be executed, in the event that given condition is legitimate
  • Use else proclamation to show a block of code to be executed, in case a comparative condition isn't substantial
  • Use else if articulation to decide one more condition to test, on the off chance that the main given conditions isn't correct
  • Use change articulation to decide elective blocks of code to be executed in the event that Assertion


Use the if explanation to decide a block of C++ code to be executed if a condition is substantial.




Linguistic structure :

if ( given condition )

{

    block of proclamations;

}


Note that accepting for a moment that is in lowercase letters. Uppercase letters (On the off chance that or, once more IF) will create a blunder.


Stream Diagram of if articulation



For Instance:

We should we test two numbers values to see if 22 is bigger than 8. Expecting to be that (if) the condition is legitimate, print some text:


Code in C++


#incorporate <iostream>

utilizing namespace sexually transmitted disease ;


int principal( ) {

  if (22 > 8) {

    cout << " 22 is more noteworthy than 8 " ;

  }

  return 0 ;

}


Result of above Code


22 is more noteworthy than 8


We will talk about excess restrictive articulations in next articles in subtleties containing definition , stream diagram , linguistic structure and Code in C++ with its Result.


I really want to believe that You can undoubtedly Comprehend and Realize this Article


Good luck 😇

Post a Comment

0 Comments