Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

problem with Search loop.

Options
  • 26-10-2011 4:12pm
    #1
    Closed Accounts Posts: 2,663 ✭✭✭


    ok, im writing a bit of code but i cant seem to get the loop working where i need to Search the whole Struct Array to find 2 items.

    struct 1.
    int ID.
    int No.
    String text
    int No.
    String Text

    struct 2.
    String text.
    int No.

    Ok, Im setting up a loop of the Sturcts that will ask the user how many times do he want to Loop Input.. Struct 2 will Loop 3 times for each time Struct 1 loops..

    what i like to be able to get done is.

    Search for a Word in both Structs once that word is found find ask User to find another Word..

    if found, Output the Words more then once if they were inputted more then once.


Comments

  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    How do you mean search for a word in both structs. Search the name string of each for the word or just do a comparison to the word.

    You will have to give more details as I can't make out what you are doing.
    Search for a Word in both Structs once that word is found find ask User to find another Word..
    I'm a little confused by this.

    Thanks


  • Closed Accounts Posts: 2,663 ✭✭✭Cork24


    EG..

    Enter Town your looking for ?
    cin >> New York

    Enter Town 2 your looking for ?
    cin >> Boston

    " Some Text " New York " Some text " Boston " some text " .

    if the first one is not found exit the search function. Same goes for the Second one as well


Advertisement