Blog Introductions

In this  blog contains tutorials about  HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials,  Examples, Source code,Learning,
Tips and Software development  services. C++ If-else condational statements  | C++ Tutorials  Bestitworriors

 

C++ If-else condational statements  

C++ Tutorials






C++ If-else condational statements  | C++ Tutorials  Bestitworriors - If-else use to check the condation base on value.If condation match the output the if block other wise output the else part.We can further add else-if to check further condations.If condation match then execute the code other wise it will further go to else block.The syntex is if(condation==value){// execute code } else {//code}.By using this syntex you can use multiple if-else in your code.


Some Key Points of C++ IF-Else




  1. If-else execute on condation base
  2. IF condation match then execute if block code
  3. If Condation don't match then execute else part
  4. We can use multiple if-else in code
  5. If-else is very easy to write code on condation base
  6. Inside if condation we check various condations
  7. Less than: a < b
  8. Less than or equal to: a <= b
  9. Greater than: a > b
  10. Greater than or equal to: a >= b
  11. Equal to a == b
  12. Not Equal to: a != b

Code





# include <iostream>


using namespace std;

int main()
{

int var1 = 20;
int var2 = 18;
if (var1 > var2)
{
cout << "var1 is greater then var2";
}
else if (var1 == var2)
{

cout << "var1 is equal to var2";

}
else
{
cout << " Var1 is less then var2";
}

return 0;

}



OutPut

var1 is greater then var2




OutPut

var1 is greater then var2

I hope You really enjoyed this blog . I try my best to make every thing is easy and helpfull to provide to public .You will get more blog about the Programing project and code . Thanks for visiting my blog if you have any querry related to this you can comment here i will try my best to response you back about C++ If-else condational statements  | C++ Tutorials  Bestitworriors