Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

problem with Search loop.

  • 26-10-2011 04: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, Registered Users 2 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