Im working on a robot project for my intro to computing science class and I'm stuck in quite a sticky situation. The robot reads only values from 1 to 4 to move north, east, south, west, 1,2,3,4 respectively. 1 = north, 2 = south...
But the catch here is if I enter a 0 or negative number then my program should read "end of journey" how do I actually implement that into my statement?
this is what I have so far,
Code:
while ( direction > 0)
{//opens bracket for the loop
if (direction == NORTH)
{
cout << "Move north\n";
}
else if (direction == EAST)
{
cout << "Move east\n";
}
else if (direction == SOUTH)
{
cout << "Move south\n";
}
else if (direction == WEST)
{
cout << "Move west\n";
}
else
{
cout << "Invalid positive input for direction\n";
}
cout << "Enter direction values again\n";
cin >> direction;
what am I doing wrong? Please and thank you, anything is appreciated.