I can't seem to get this code to work. I'm just beginning c++ and this is one of my assignments. For some reason it says the + and - operators won't aren't doing anything.
Say someone enters "N". And then what? It will enter the if statement forever, because you dont give the user another chance at choosing a direction so they cant quit, and position will always be equal to "N" because you again, never ask them the question again. Move the cin >> position; to inside the loop.
positionArray[0, 1] is really just the same as positionArray[1]. It accesses the second element in the array.
positionArray[1] + 1; doesn't do anything. If you want to increase the value of the second array element by one you have to do positionArray[1] = positionArray[1] + 1; or positionArray[1] += 1; or you could also do ++positionArray[1];
Thank you both a lot. I only have one more problem, I can't seem to get it to print both elements of the array. What am I doing wrong with that part?
edit: nevermind. I figured that out. I just put it like: cout << positionArray[0] << positionArray[1]. Which ended up solving my problems. thanks again!