The conditions in a switch-case statement must be of _______ data type.
- floating
- string
- integer or enum
- boolean
In a switch-case structure in C++, the conditions or cases must be of an integer or enumeration type. Floating-point and boolean values cannot be used as cases.
Loading...
Related Quiz
- Which STL container provides constant time access to elements but may take linear time to insert a new element?
- A C++ project is exhibiting memory leaks, but it is unclear where they originate. Considering the tools and features available in modern C++, which approach might be most efficient in tracking down and resolving the memory leaks?
- In a function that needs to return multiple values, which method of parameter passing might be employed to facilitate this without using data structures like tuples or pairs?
- You are implementing a recursive algorithm and observe that it recalculates the same values multiple times, leading to inefficient execution. What technique might be most effective in reducing the redundant calculations?
- How does C++ treat an enum regarding its type and size?