Create a program that uses a derived class based on the list class you\'ve creat
ID: 3839688 • Letter: C
Question
Create a program that uses a derived class based on the list class you've created in the first program. This program will use a stack data type. class node {void * info; node * next; public: node (void *v) (info = v; next = 0;)} void put_next (node*n) (next = n;)} node*get_next() {return next;} void*get_info() {return info;}}; class list{node * head; int node_num; public: list() {node_num = 0: head = 0;} void remove (int); void insert (void *, int); void append (void * v) {insert (v, node_num + 1); void*find (int); void display Write functions to push and pop the stack. Write a driver mainprogram which gives 5 values (5 nodes created) that will push, pop and display data stored.Explanation / Answer
# Store input numbers num1 = input('Enter first number: ') num2 = input('Enter second number: ') # Add two numbers sum = float(num1) + float(num2) # Display the sum print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.