Article View: rec.games.programmer
Article #1608Goto [variable] in C++ ?
From: Aphoriel/Kinsman
Date: Mon, 28 Dec 1992 14:44
Date: Mon, 28 Dec 1992 14:44
18 lines
1039 bytes
1039 bytes
This is a question from someone new to C... How could I set up C code so that a program goes to a function where the name of the function is placed in a string variable? The specific use I'm thinking of is for an adventure game, where the function the parser calls depends on the verb the player used in typing in his command.. I could set it up as: -If verb_parsed is 'eat' then call eat_function -If verb_parsed is 'give' then call give_function and so forth, but this is awful... How could I write it in C to look like: -Go to [verb_parsed + string_holding_parameter_characters] Like that. Thanks in advance, -Sean Givan / Aphoriel/Kinsman
Technical Details
Message-ID:
<1992Dec28.144429.1427@jupiter.sun.csd.unb.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!torn!csd.unb.ca!kinsmanShow Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!torn!csd.unb.ca!kinsman From: kinsman@jupiter.sun.csd.unb.ca (Aphoriel/Kinsman) Subject: Goto [variable] in C++ ? Message-ID: <1992Dec28.144429.1427@jupiter.sun.csd.unb.ca> Organization: University of New Brunswick Distribution: rec.games.programmer Date: Mon, 28 Dec 1992 14:44:29 GMT Lines: 19