home *** CD-ROM | disk | FTP | other *** search
- Path: 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
-
-
- 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
-