Question: USING C++ #include using namespace std; struct node { int info; node *next; }; class sll { private: node *head; public: sll(){head=NULL;} void AddNode (int);

USING C++

#include

using namespace std;

struct node

{

int info;

node *next;

};

class sll

{

private:

node *head;

public:

sll(){head=NULL;}

void AddNode (int);

void Traverse();

int even();

};

void sll::AddNode (int val)

{

}

void sll::Traverse()

{

}

int sll::even ()

{

}

int main()

{

sll s;

int inf, ch;

while(1)

{

cout<<" Linked List Operations 1- Add New value to the list 2- Traverse List 3- Count the number of even numbers 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 number of even values in the list = "<

break;

default: exit(0);

}

}

return 0;

}

This program stores a list of integer numbers dynamically through a singly linked list, complete it by defining the following functions:

1- AddNode (int): Adds a new node at the end of the list.

2- Traverse(): Prints the values stored in the list.

3- int even(): Returns the number of even integers in the list.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets complete the C program by implementing the missing functions for the singly linked list AddNode Traverse and even Here is a stepbystep explanatio... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!