#include <iostream>
using namespace std;
class Navigation {
int north, west;
public:
void set_values(int,int);
} coords;
void Navigation::set_values (int a, int b) {
int north = a;
int west = b;
}
int main()
{
Navigation coords;
Navigation north;
Navigation west;
coords.set_values (0,0);
char direction;
cout << "Would you like to go N, E, S, W?";
cin >> direction;
switch (direction) {
case 'N':
++north;
break;
case 'E':
--west;
break;
case 'S':
--north;
break;
case 'W':
++west;
break;
default:
cout << "N, E, S, W only!";
break;
}
cout << "Your co-ordinates are now: " << north << west << endl;
return 0;
}
/cry ;[
"no match for operator++ in ++north


Sign In
Create Account



Back to top









