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++ Switch Case Conditional statement |  C++ tutorials Bestitworriors


C++ Switch Case Conditional statement



C++ tutorials



C++ Switch Case Conditional statement |  C++ tutorials Bestitworriors - Switch is use to select one block out of many block.In switch we use case to check the condation .If certein condation is match then execute the following code.If none of case is match then execute the default block.Switch is easier to write rather the writing many if-else condations.

Some Key Points of C++ Switch


  1. In Switch we pass parameter to check condation
  2. In Switch we use case statement to check the condations
  3. If none of case match then swich execute default block
  4. Switch is easir to write and take less time then multiple if-else
  5. Switch case check condation if match then execute the following block
  6. Switch is usefull when multiple condation occure

Code



#include <iostream>
using namespace std;

int main() {

int months = 4;
switch (months) {
case 1:
cout << "January";
break;
case 2:
cout << "Feburary";
break;
case 3:
cout << "March";
break;
case 4:
cout << "April";
break;
case 5:
cout << "May";
break;
case 6:
cout << "June";
break;
case 7:
cout << "Jully";
break;
}
return 0;

}


Output

April


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++ Switch Case Conditional statement |  C++ tutorials Bestitworriors