Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 oList);

int main()

{

circularLinkedList list1, list2;

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 oList)

{

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

What is MSb on your Excel printout?

Answered: 1 week ago