# link lists in c – Essay Writers

link lists in c – Essay Writers

Build a linked list of random integers, each integer less than 100. Rather than asking the user ahead of time how long the list will be, just have your program ask each time whether it should add a new number to the list. After the user indicates that the list is done, print out the entire list. Then go into a loop in which the program asks whether or not the user wants to search the list and if so, what value should be searched for. If the desired item is on the list, print it out and its position in the list; otherwise, just say that the search was unsuccessful. Run at least two searches, one of which is successful, one of which is not. Here’s a sample printout:

Put a number in the list? [y/n]: yYour number is 33Put another number in the list? [y/n]: yYour number is 43Put another number in the list? [y/n]: yYour number is 62Put another number in the list? [y/n]: yYour number is 29Put another number in the list? [y/n]: yYour number is 0Put another number in the list? [y/n]: yYour number is 8Put another number in the list? [y/n]: yYour number is 52Put another number in the list? [y/n]: nHere’s your list, from the most recent entry to the oldest:52 8 0 29 62 43 33Would you like to search the list? [y/n]: yEnter a number to be searched for: 2929 is item #4 on the list
Would you like to search the list again ? [y/n]: yEnter a number to be searched for: 17The search for 17 was unsuccessful
Would you like to search the list again ? [y/n]: n
Notes:

Use no ‘for’ loops in this program; do it all with ‘while’ loops. No arrays in this program, all the random numbers go only in the linked list.
Do this whole program in your main function. That’s not good software engineering, but it will simplify your life a bit and on this first program with linked lists, I’d like to keep things as simple as possible. Don’t say I never do anything for you.
Reminder When controlling your program’s behavior with single character input (as I did, above,with the choice of ‘y’ or ‘n’), read in the user input like so: scanf(” %c”, &whatever)

What to turn in:
Upload the typescript file with –

cat -n of your .h file(s) (if used)
cat –n of your .c file