#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    C programming: User key in search word, print all matching data.


    Dear all,

    Hope someone could teach me on how to code: when user input search word, the output will print out all matching data.

    In a list of data (example 40 string text data)
    Example {Testing 1, Testing 2, Friend 3, Friend 4, Max 5, Max 6, ....., rubbish 40}

    when a user input a search text --> "Testing"
    Output should shown matching data: Testing 1 & Testing 2.

    i tried using "for" loop. but instead of printing "Testing 1 & Testing2", the output keep printing "Testing 1". (sorry i do not have the code with me now).

    could some1 please enlighten me with some code to search the user input in a list of text and print out all match data?

    thanks :)
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,379
    Rep Power
    1871
    > sorry i do not have the code with me now
    Come back to us when you do have the code.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0
    found the mistake.
    thanks salem~

IMN logo majestic logo threadwatch logo seochat tools logo