Need some quick help with this code - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Need some quick help with this code

Hi, I'm trying to put what little i've learned so far to use.

As I said before my goal is to make a text-based rpg...so i decied to write up a room description and see if i could make it switch back and forth between rooms based on the user's input:


#include

int main()

{

cout << "You are standing in the middle of a large chamber.
"<br>
"Obvious Exits: North, South
";

enum Directions {North=1, South=2};

char x;

cin >> x;

char N = 1;

char S = 2;

if (x = N)

cout << "Display North
";<br>
if (x = S)

cout << "Display South
"; <br>
return 0;

}


The only problem is that no matter what you push (N or S) it will write Display North

Display South.


Does anyone have any suggestions as to how i could make it just write Display North when i enter N

and Display South when i enter S?


Penance




Comments

Sign In or Register to comment.