Question: In C++. Thanks. In this program you will be modifying either program 4 or 5 (if you were able to finish program 4 then you
In C++. Thanks.
In this program you will be modifying either program 4 or 5 (if you were able to finish program 4 then you must modify program 4, otherwise modify program 5).
In the modification, you will be moving Node to be an outer class. Once you have done that, then you are to convert all the classes(Node and LinkedList ) to use templates.
Here on Canvas, out in the Files/Lecture folder there is a pdf called "Program 6 Notes Templates" that gives you instructions on how to walk through this process.
This process of converting a class to templates may give you some strange errors, and this is why I gave you a whole class to work on this with some assistance. If you are having problems getting things to work and aren't able to finish it in the class time given, then I would recommend to come to the Open Lab time after the later class or my office hours on Wednesday and Friday.
Modifications to Main if you are modifying program 4:
Do the normal requirements from program 4
- read into list1 and list2
- make modlist1 and modlist2 and remove the word as before
- cout the size of the 4 lists
- cout the first 5 words from modlist1 and modlist2 using iterators
- add the following modifications to main to create other types of LinkedList
LinkedListintList; for (int i = 20; i > 0; i -= 2) intList.insert(i); for (int i = 25; i > 0; i -= 5) intList.insert(i); cout << "intlist: " << intList << " size:" << intList.size() << endl << endl; LinkedList dblList; for (double i = 10.9; i > 0; i-=.57) dblList.insert(i); cout << "dblList: " << dblList << " size:" << dblList.size() << endl << endl;
Modifications to Main if you are modifying program 5:
Do the normal requirements from program 5....the merging
- Then add the code below the merging....
LinkedListdblList; for (double i = 10.9; i > 0; i-=.57) dblList.insert(i); cout << "dblList: " << dblList << " size:" << dblList.size() << endl << endl; LinkedList strList; // or string strList.insert(MyString(foo); strList.insert(MyString(bar); strList.insert(MyString(zip); strList.insert(MyString(ftl); cout << strList: " << strList << " size:" << strList.size() << endl << endl;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
