🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #1622

Re: Goto [variable] in C++ ?

#1622
From: Chad R. Collins
Date: Tue, 29 Dec 1992 04:03
26 lines
1318 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: <1992Dec29.040359.28909@blkbox>
Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!blkbox!collins
References: <1992Dec28.144429.1427@jupiter.sun.csd.unb.ca>

Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!blkbox!collins
From: collins@blkbox (Chad R. Collins)
Subject: Re: Goto [variable] in C++ ?
Organization: The Black Box, PO Box 591822 Houston, TX 77259-1822 
Distribution: rec.games.programmer
Date: Tue, 29 Dec 1992 04:03:59 GMT
Message-ID: <1992Dec29.040359.28909@blkbox>
References: <1992Dec28.144429.1427@jupiter.sun.csd.unb.ca>
Lines: 27