⇧
Contact Us
||
Privacy Policy
||
About Us
Home
C++
Java
HTML
CSS
Bootstrap
PHP
Program
Interview Ques
Menu ▼
C++ Tutorial
What is C++
History of C++
Feature of C++
Simple Program in C++
Variable in C++
Data Types in C++
Keyword in C++
Operator in C++
Identifiers in C++
Control Statement
Control Statement in C++
1) If Else in C++
2) Switch Case in C++
3) Loop in C++
4) While Loop in C++
5) Do While in C++
6) Break in C++
7) Continue & GOTO
Array
Array in C++
Array of String in C++
pointer-in-cplusplus
Function
What is Function in C++
Call by Value and Call by Reference
Recursion in C++
Storage Class in C++
next →
← prev
Switch Statement in C++
In Switch statement multiple conditions but executes one statement
switch(expression){ case value1: //statement to be executed; break; case value2: //statement to be executed; break; ...... default: //statement to be executed if all cases are not matched; break; }
C++ Switch Example
#include
using namespace std; int main () { int day = 4; switch (day) { case 1: cout << "Monday"; break; case 2: cout << "Tuesday"; break; case 3: cout << "Wednesday"; break; case 4: cout << "Thursday"; break; case 5: cout << "Friday"; break; case 6: cout << "Saturday"; break; case 7: cout << "Sunday"; break; }}
Output:
Thursday
Next Topic
Iteration Statement or Loops in C++
← prev
next →