Question
C++ Circular Linked Lists Instructions Use Provided Main 1. Write the definitions of the class circularLinkedListand its member functions. (You may assume that the elements
C++ Circular Linked Lists
Instructions
Use Provided Main
1. Write the definitions of the class circularLinkedListand its member functions. (You may assume that the elements of the circular linked list are in ascending order.)
2. Write a program to test various operations of the class defined in the step above.
Main.cpp
#include
#include "circularLinkedList.h"
using namespace std;
void testCopyConstructor(circularLinkedList
int main()
{
circularLinkedList
int num;
cout << "Enter number ending with -999" << endl;
cin >> num;
while (num != -999)
{
list1.insertNode(num);
cin >> num;
}
cout << endl;
cout << "List 1: ";
list1.print();
cout << endl;
cout << "Length List 1: " << list1.length() << endl;
cout << "Enter the number to be searched: ";
cin >> num;
cout << endl;
if (list1.search(num))
cout << num << " found in the list" << endl;
else
cout << num << " not in the list" << endl;
cout << "Enter the number to be deleted: ";
cin >> num;
cout << endl;
list1.deleteNode(num);
cout << "After deleting the node, "
<< "List 1: ";
list1.print();
cout << endl;
cout << "Length List 1: " << list1.length() << endl;
list2 = list1;
cout << "List 2: ";
list2.print();
cout << endl;
cout << "Length List 2: " << list2.length() << endl;
testCopyConstructor(list1);
cout << "List 1: ";
list1.print();
cout << endl;
return 0;
}
void testCopyConstructor(circularLinkedList
{
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started