Which statement is best suited for selecting one of many blocks of code to be executed?

  • if-else statement
  • for loop
  • switch statement
  • while loop
The 'switch' statement in C++ is best suited for selecting one of many blocks of code to be executed. It allows you to define multiple code blocks (cases) and select one based on the value of an expression. This is particularly useful when you need to choose from several options.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *