i need little help of urs in the above code, RightFrom Function is perfectly working but there is a logic bug in LeftFrom Function.
when i m sending North as argument the result from LeftFrom is -1 but i need 0. help me to solve this issue.
#include <iostream>
using namespace std;
enum direction{
North,
East,
South,
West,
};
direction RightFrom(direction d){
return direction((d+1) % 4);
}
direction LeftFrom(direction d){
return direction((d-1) % 4);
}
void main(){
cout << RightFrom(West) << endl; // West = 4 and it will output 0 as required
cout << LeftFrom(North) << endl; // North = 0 and it will output -1 ( but i need the result 0)
}