link lists in c

We can write your essays! Let our essay writing experts help you get that A in your next essay. Place your order today, and you will enjoy it. No plagiarism.


Order a Similar Paper Order a Different Paper

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]: y

Your number is 33

Put another number in the list? [y/n]: y

Your number is 43

Put another number in the list? [y/n]: y

Your number is 62

Put another number in the list? [y/n]: y

Your number is 29

Put another number in the list? [y/n]: y

Your number is 0

Put another number in the list? [y/n]: y

Your number is 8

Put another number in the list? [y/n]: y

Your number is 52

Put another number in the list? [y/n]: n

Here’s your list, from the most recent entry to the oldest:

52 8 0 29 62 43 33

Would you like to search the list? [y/n]: y

Enter a number to be searched for: 29

29 is item #4 on the list

Would you like to search the list again ? [y/n]: y

Enter a number to be searched for: 17

The 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
  • gcc of your .c file
  • a.out
Writerbay.net

Everyone needs a little help with academic work from time to time. Hire the best essay writing professionals working for us today!

Get a 15% discount for your first order


Order a Similar Paper Order a Different Paper