Purchase Solution

List Program C++ with multiple operations

Not what you're looking for?

Ask Custom Question

You are to implement a 'List' class to handle a list with general operations. That means you can insert and delete any element anywhere in the list. The list has no order, except for the order you insert or delete. The methods you are to implement are as given:

Constructor methods (two, default and copy constructor, a list to a newly defined list, i.e. 'List listA(listB)'):

Empty returns true or false if list is empty or not.
Front makes current position at the beginning of the list.
End makes current position at the end of a list.
Previous places current position at the previous element in the list.
Next places current position at the next element in the list.
Get position returns current position or where you are in the list.
Set position (int) places current position in a certain position in the list.
Insert before inserts as a new element before the current position.
Insert after inserts as a new element after the current position.
Get element returns the one element that current position is pointing to.
Size returns the size of the list (number of elements in list).
Replace (int) replace the current element with a new value.
Erase deletes the current element.
Clear makes the list an empty list.
Reverse reverses elements in a list.
Swap swaps all the elemments of one list with the another list.

Overload the operators: (at least) << output, == , + , = (assignment)

You are to implement the List class using an array. For now the array can be 20 in size.
You will need to use the 'ElementType' for 'typing' your data.
You will need to use CAPACITY constant for the size of the array, in case we need to change the array size.
When adding two lists make sure its within capacity, otherwise ignore it.
When printing out the array across the screen horizontally, print only values that have been inserted, not all zeros.

Please see the attachement as well.

Attachments
Purchase this Solution

Solution Summary

The solution contains an List.h with C++ list implementation and a ListMain.cpp testing program that calls list methods. The list requested is implemented using an array.

Purchase this Solution


Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.