Results 1 to 5 of 5

Thread: c++ question

  1. #1
    Join Date
    May 2008

    c++ question

    I have a list of items that I want a user to be able to select from but when one item is selected I want that item to be removed off the list and I want the list to be re-listed again without the chosen item. How can I do this? Any help would be appreciated.

  2. #2
    Join Date
    Aug 2003
    What are you specifically looking for help with? Are you trying to identify a data structure that could easily allow you to remove an element?

    Without understanding your implementation, it's hard to give a relevant answer.

  3. #3
    Join Date
    May 2008
    Yeah, I am trying to figure out how I would remove elements within a data structure.

    For example when a user has selected the third option in a menu, how could I remove this option and print the menu again without that third option?


    1. cats
    2. dogs
    3. gerbils // user selects gerbils
    4. hamster

    2.dogs // gerbils is no longer on the list but hampster gets
    3.hamster // moved up one spot

  4. #4
    Join Date
    May 2009
    Looks like a job for a doubly-linked list to me. If you've never made one before, you should google "c++ linked list tutorial" or buy a book. If you want a really solid foundation in elemental data structures, you should look at stacks and queues first.

  5. #5
    Join Date
    Mar 2009
    Gods Own Country
    if your array items are not populated dynamically, you can stick with a 2D character array. You need to use strncpy() to move items up, overwriting the selected item. That is, if a user selects (i)th item, copy (i+1)th item to i till the (n)th element of the array.
    Fabin Mundattil @ Xieles Support
    High Quality Server Management | support @

Similar Threads

  1. A Question of Space & Price - a big question!
    By active8 in forum Running a Web Hosting Business
    Replies: 7
    Last Post: 05-18-2006, 05:55 PM
  2. AdSense Ads Question + Domain Question
    By youngwun0 in forum Web Design and Content
    Replies: 8
    Last Post: 08-29-2005, 11:52 PM
  3. Replies: 10
    Last Post: 05-08-2003, 08:28 AM
  4. question (and a phpBB question)
    By Zero Enna in forum Web Hosting
    Replies: 29
    Last Post: 04-05-2002, 01:33 PM
  5. Hosthideout question (really just chat question)
    By Chicken in forum Other Offers & Requests
    Replies: 12
    Last Post: 02-07-2002, 12:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts