home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / rec / games / programm / 5206 < prev    next >
Encoding:
Text File  |  1992-12-28  |  1012 b   |  30 lines

  1. Newsgroups: rec.games.programmer
  2. Path: sparky!uunet!spool.mu.edu!torn!csd.unb.ca!kinsman
  3. From: kinsman@jupiter.sun.csd.unb.ca (Aphoriel/Kinsman)
  4. Subject: Goto [variable] in C++ ?
  5. Message-ID: <1992Dec28.144429.1427@jupiter.sun.csd.unb.ca>
  6. Organization: University of New Brunswick
  7. Distribution: rec.games.programmer
  8. Date: Mon, 28 Dec 1992 14:44:29 GMT
  9. Lines: 19
  10.  
  11. This is a question from someone new to C...
  12.  
  13. How could I set up C code so that a program goes to a function where the name
  14. of the function is placed in a string variable? The specific use I'm thinking
  15. of is for an adventure game, where the function the parser calls depends on
  16. the verb the player used in typing in his command.. I could set it up as:
  17.  
  18. -If verb_parsed is 'eat' then call eat_function
  19. -If verb_parsed is 'give' then call give_function
  20.  
  21. and so forth, but this is awful... How could I write it in C to look like:
  22.  
  23. -Go to [verb_parsed + string_holding_parameter_characters]
  24.  
  25. Like that.
  26.  
  27. Thanks in advance,
  28. -Sean Givan / Aphoriel/Kinsman
  29.  
  30.