Code has been added to clipboard!
Switch Statement Syntax
Example
#include <iostream>
using namespace std;
int main() {
int k = 1;
switch (k) {
case 1: // will be executed if k = 1;
break;
case 2: // will be executed if k = 2;
break;
default: // will be executed if k doesn't match any cases
break;
}
}