Loops

This is a discussion on Loops within the C++ Programming forums, part of the General Programming Boards category; I have to write a program in C++ that is like a database, that is it lets the user enter ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Location
    Colorado
    Posts
    2

    Question Loops

    I have to write a program in C++ that is like a database, that is it lets the user enter name, address, ect. then loop back to the main menu so the user can choose another option. Does anyone have any ideas on how I would loop that and how i would count the user entries??

    Does any one know how to delete one record in a linked list??
    Any advice or pointers would be great!!

    Thanks

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    Does anyone have any ideas on how I would loop that
    Code:
    do
    {
         //choose option
    
    }while(/*some loop ending condition*/);
    Does any one know how to delete one record in a linked list??
    If it's a singly linked list, advance two pointers through the list: one pointing to the first node one pointing to the second node. If the leading pointer matches the node you are looking for, use it's next pointer to get the next node and assign the next node to the trailing pointer's next pointer. Then assign 0 to the current node's next pointer.

    You'll have to take care of the case when the first node is the one you want to remove, which just involves setting its next pointer to null.
    Last edited by 7stud; 12-02-2005 at 12:22 AM.

  3. #3
    Registered User
    Join Date
    Nov 2005
    Location
    Colorado
    Posts
    2
    thank you very much for your help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Too many loops D:
    By F5 Tornado in forum C++ Programming
    Replies: 6
    Last Post: 12-03-2007, 12:18 AM
  2. loops with incrementing strings .... ?
    By twomers in forum C++ Programming
    Replies: 1
    Last Post: 12-12-2005, 10:29 AM
  3. strings and loops...
    By twomers in forum C Programming
    Replies: 5
    Last Post: 12-12-2005, 10:28 AM
  4. help with arrays and loops
    By jdiazj1 in forum C Programming
    Replies: 4
    Last Post: 11-24-2001, 03:28 PM
  5. for loops - newbie q's
    By Narciss in forum C Programming
    Replies: 8
    Last Post: 09-26-2001, 02:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21