Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   need some help with strings (http://www.go4expert.com/forums/help-strings-t15223/)

cpulocksmith 21Nov2008 06:56

need some help with strings
well ok, i need some help i am fairly sure this is a simple matter but i cannot figure it out. lets say i want to write a program that when i say look at the tree i will be givin a better discription of the tree. or what ever. i have some idea of what i would have to do for that. i have tried many things and they all seem to fail. if some one could please tell me how this can be done i would be vary happy. and the tree thing that is just an example...

xpi0t0s 21Nov2008 23:37

Re: need some help with strings
Bit of a vague description but I guess you're thinking along the lines of adventure programs where you issue commands like "LOOK AT TREE" and the program prints a suitable description. Would that be correct?

If so all you need to do (!) is implement a command parser that takes user commands and works out what they mean, validates them against the current context (e.g. if there is no tree then it would print an error), then displays an appropriate description, which might be stored in static text somewhere, or might be kept in an indexed file.

All times are GMT +5.5. The time now is 19:10.