need some help with strings

Discussion in 'C' started by cpulocksmith, Nov 21, 2008.

  1. cpulocksmith

    cpulocksmith New Member

    Joined:
    Jul 23, 2008
    Messages:
    289
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    student
    Location:
    canada
    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...
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice