PROGRAMMING:Creation, traversal and destruction of single linked list
Enter any number of positive integers from the keyboard, and the input ends with - 1. Output these integers in reverse order (excluding - 1).
Tips:
1. Create a single linked list in reverse order. The node data field is an integer number. For each integer input, a node is inserted into the linked list. When - 1 is entered, the creation of the linked list ends.
2. Traverse the linked list and output the value of the node data field.
3. After traversal, it is required to destroy the linked list.
###Input format:
Any number of positive integers whose input sequence ends with - 1.
###Output format:
Output these integers in reverse order (excluding - 1).
###Input example:
Here is a set of inputs. For example:
```in
3 8 2 9 7 4 -1
```
###Output example:
The corresponding output is given here. For example:
```out
4 7 9 2 8 3
```
answer:If there is no answer, please comment
Tips:
1. Create a single linked list in reverse order. The node data field is an integer number. For each integer input, a node is inserted into the linked list. When - 1 is entered, the creation of the linked list ends.
2. Traverse the linked list and output the value of the node data field.
3. After traversal, it is required to destroy the linked list.
###Input format:
Any number of positive integers whose input sequence ends with - 1.
###Output format:
Output these integers in reverse order (excluding - 1).
###Input example:
Here is a set of inputs. For example:
```in
3 8 2 9 7 4 -1
```
###Output example:
The corresponding output is given here. For example:
```out
4 7 9 2 8 3
```
answer:If there is no answer, please comment