• Advertisement

Archived

This topic is now archived and is closed to further replies.

need help!!

This topic is 5885 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can someone tell me what the hell is wrong with this code please???? I was testing some stuff and this seemed to show more effort in working. Forget the text written in it, I was screwing around. getch(); printf(" "); 0; printf("What would you like to do?\n"); action = getch(); if (action == ''1'') goto <1>; if (action == ''2'') goto <2>; if (action == ''3'') goto <3>; if (action == ''4'') goto <4>; if (action == ''5'') goto <5>; printf("Not an option. Try again.\n"); goto <0>; 1 printf("You walk to the tavern......\n"); printf("You are now inside the tavern.\n"); printf("Inside, you see a couner with an old man behind it.\n"); printf("He asks you if you would like to buy something and hands you\n"); printf("a piece of paper with the price list on it. It reads:\n"); printf(" "); printf("chop suey - 2,000,000gp\n");

Share this post


Link to post
Share on other sites
Advertisement
Hi,

int getch(void) <------ Note getch returns and "int", so it would be

int action = getch();

if(action == 1)
if(action == 2)
...

Suggest you use "swtich"

switch(action) {
case 1 : ...
case 2 : ...
...
}

Share this post


Link to post
Share on other sites

  • Advertisement