Article View: rec.games.programmer
Article #1634Goto [variable] in C++ ?
From: Chad.R..Collins Chad R. Collins
Date: Tue, 29 Dec 1992 11:03
Date: Tue, 29 Dec 1992 11:03
29 lines
1237 bytes
1237 bytes
kinsman@jupiter.sun.csd.unb.ca (Aphoriel/Kinsman) writes: >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 Well, I don't know the specifics of what you are doing, but you might want to look into the switch/case statements.... Chad R. Collins collins@blkbox.com
Technical Details
Message-ID:
<725647749.AA00000@therose.pdx.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!olivea!charnel!psgrain!qiclab!therose!postmasterShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!charnel!psgrain!qiclab!therose!postmaster From: Chad.R..Collins@f7.n105.z1.fidonet.org (Chad R. Collins) Newsgroups: rec.games.programmer Subject: Goto [variable] in C++ ? Message-ID: <725647749.AA00000@therose.pdx.com> Date: 29 Dec 92 11:03:59 GMT Sender: postmaster@therose.pdx.com Lines: 29