Question: Suppose that the direction variable is declared as follows: enum {NORTH, SOUTH, EAST, WEST} direction; let x and y be int variables. Write switch statement
- Suppose that the direction variable is declared as follows:
enum {NORTH, SOUTH, EAST, WEST} direction;
let x and y be int variables. Write switch statement that tests the value of direction. Incrementing x if direction is EAST, decrementing x if direction is WEST, incrementing y if direction is SOUTH, and decrementing y if direction is North.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
