C++ Hướng đối tượng, Linked List (danh sách liên kết)

Threads: C++

 Hướng dẫn học C++ từ Cơ bản đến nâng cao 

GOAL

  • Implement the "insert at tail" function for the linked list code provided
  • Use the prototype provided to complete your function

DETAILS

  • Follow the 'TODO' clues in the insertAtTail() function

HINTS

  • Your while loop will need to continue while temp->next is not nullptr
  • Inside your while loop, you only need to advance temp to its next pointer (regardless of whether next is null or not)

SUBMISSION

  • Test your program interactively to be sure you can insert words at the end of the list

SAMPLE OUTPUT

(empty)
What word would you like to insert? foo
foo, 

What word would you like to insert? bar
foo, bar, 

What word would you like to insert? wow
foo, bar, wow, 

What word would you like to insert? oh
foo, bar, wow, oh, 

What word would you like to insert? oops
foo, bar, wow, oh, oops, 

Please login or register to see more...

Tags: C++, OOP

Reviews

Please login or register to comment