New filters on the Home Feed, take a look!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

0
need some help
Post Flair (click to view more posts with a particular flair)
Post Body

so i seem to be having an issue with my code. It is a very basic program. All it does is ask you where you want to go and adjust the coordinates accordingly but i cant seem to get the integers to increase or decrease when i tell it to any suggestions? of it is written in c

#include <iostream>

using namespace std;

int main()
{
bool quit = false;

while ( !quit )
{
    char userDirect = 'n';

    int x = 0;
    int y = 0;

    cout << "Coordinates: ("<<x<<","<<y<<")" << endl; 
    cout << "Where would you like to go? (N)orth (E)ast (S)outh (W)est: " << endl;
    cout << "(Q) to Quit." << endl;
    cin >> userDirect;

        if( userDirect == 'n' || userDirect == 'N' )   x;   

        else if( userDirect == 'e' || userDirect == 'E' )   y;      

        else if( userDirect == 's' || userDirect == 'S' ) --x;

        else if( userDirect == 'w' || userDirect == 'W' ) --y;

        else if( userDirect == 'q' || userDirect == 'Q' )
        {
            cout << "Quiting... ";
            quit = true;
        }


}
}

Duplicate Posts
74 posts with the exact same title by 63 other authors
View Details
Author
Account Strength
80%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
32
Link Karma
26
Comment Karma
6
Profile updated: 1 day ago
Posts updated: 7 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
10 years ago