Question: The following program stores a list of integer numbers dynamically through a singly linked list, complete it by defining the following functions: AddNode (int): Adds
The following program stores a list of integer numbers dynamically through a singly linked list, complete it by defining the following functions: AddNode (int): Adds a new node at the beginning of the list. Traverse(): Prints the values stored in the list. float avg():Returns the average of information fields in the list.
#include
} void sll::Traverse() {
} float sll::avg () { }
int main() { sll s; int inf, ch; while(1) { cout<<" Linked List Operations 1- Add New value to the list 2- Traverse List 3- Average of information fields in the list. 4- Exit Your Choice: "; cin>>ch; switch(ch) { case 1: cout<<" Put info/value to Add: "; cin>>inf; s.AddNode(inf); break; case 2:cout<<" Linked List Values: "; s.Traverse(); break; case 3: cout<<" The average of information fields in the list = "<
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
