Skip to main content
gamedev.net
🔒 Locked

need help!!

Started by masterconjurer 1 reply 200+ views
Original Post
masterconjurer
masterconjurer
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");
flame_warrior
flame_warrior
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 : ...
...
}
Hello from my world
masterconjurer
masterconjurer
WOOHOO!!! Thanks! Now I finally continue on with the production of my Text-Based game!!


Master Conjurer

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.