Answers for "how to use a case loop in c++"

C++
1

how to use a case loop in c++

int x = 0;
int y = 4;
int g = 0;

switch(x) {
  	case y: // if x == y then run:
    // your code (0 != 4, this code wont run)
	break;
    
  	case g: // if g == y then run:
    // your code (0 = 0, this code will run)
    break;
    
  	default: // if none of the conditions above are met, run this:
    // your code (this is skiped, because a diferent case has been met.
    break;
}
Posted by: Guest on October-17-2021

Browse Popular Code Answers by Language