// This is version 2 of lab test #3 for lab section D2. // You are to add two new methods to the List class, found on the G: drive. // Information on the methods to add can be found below. // Submit files List.h and List.cpp using the submit program provided. #include "stdstuff.h" #include "List.h" void realMain () { List list; for (int i = 0; i < 15; i++) { list.insert ((i * i) - (8 * i) + 2); } list.outputList (); // Method "sumEvenValues" returns the sum of the nodes in the list containing even values. // Note that "containing" refers to the *contents* of the node, not its position in the list. // If the list has no even values, it returns 0. // You are to add this method to class "List". // Note that your method should work properly in all circumstances, not just for this // particular list. (Feel free to add additional test cases.) cout << "\nThe sum of even values in the list is: " << list.sumEvenValues() << "\n\n"; // Method "deleteEveryThirdNode" deletes the 3rd, 6th, 9th, etc. node of the list. // Note that the list starts with the first (not "zeroth") node. // If the list has fewer than three nodes, this method has no effect. // You are to add this method to class "List". // Note that your method should work properly in all circumstances, not just for this // particular list. (Feel free to add additional test cases.) list.deleteEveryThirdNode(); cout << "After deleting every third value, "; list.outputList (); cout << "\n"; } int main () { try { realMain (); } catch (exception &e) { cout << "Exception occurred " << e.what() << endl; } pause(); return 0; }