Question: Use the code posted in the folder BagTemplatewithIterator on our D2L website. Be sure to document your work through code comments and a written summary

Use the code posted in the folder BagTemplatewithIterator on our D2L website. Be sure to document your work through code comments and a written summary of how your code works. Create a thorough test program for the functions and show your test results with your summary of the code. #include #include #include #include #include "node2.h" #include "bag5.h" using namespace std; // PROTOTYPE for a function used by this demonstration program template void get_items(bag& collection, SizeType n, MessageType description) // Postcondition: The string description has been written as a prompt to the // screen. Then n items have been read from cin and added to the collection. // Library facilities used: iostream, bag4.h { Item user_input; // An item typed by the program's user SizeType i; cout << "Please type " << n << " " << description; cout << ", separated by spaces. "; cout << "Press the key after the final entry: "; for (i = 1; i <= n; ++i) { cin >> user_input; collection.insert(user_input); } cout << endl; } int main() { //demostrate how to use set template class set actors1; set actors2; set result; set::iterator role; actors1.insert("moe"); actors1.insert("curly"); actors2.insert("larry"); actors2.insert("curly"); for(role = actors1.begin(); role != actors1.end(); ++role) cout<<*role<<" "; cout< *head_ptr = new node(); list_head_insert(head_ptr, 42); list_head_insert(head_ptr, 13); list_head_insert(head_ptr, 67); node_iterator start(head_ptr); node_iterator finish; node_iterator position; for(position = start; position != finish; ++position) cout<<*position<< " "; cout< bag_of_int; bag bag_of_string; bag_of_int.insert(3); bag_of_string.insert("hello"); bag_of_string.insert("goodbye"); bag_of_string.insert("auf wiedersehen"); bag_of_string.insert("goodbye"); bag_of_string.insert("hello"); bag_of_string.insert("goodbye"); cout << "count of goodbye: " << bag_of_string.count("goodbye") << endl; cout << "count of guten morgen: " << bag_of_string.count("guten morgen") << endl; cout << "count of 3: " << bag_of_int.count(3) << endl; for(bag::iterator cursor = bag_of_string.begin(); cursor != bag_of_string.end(); ++cursor) cout<<*cursor<< " "; cout<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!