// Name: // Email: // Lab Day: // Lab Time: // TA: // // Lab 10 #include #include using namespace std; // The typedef for the Array class typedef double arrElem; // put your Array class here int main() { Array ar1, ar2, ar3; arrElem value; int pos, newPos; int i; // store the data from file lab10a.data into ar1 ar1.readFromFile("lab10a.data"); // print out the data in ar1 cout << "Array ar1 contains " << ar1.getSize() << " values:" << endl; ar1.printArray(); // Sort array ar1 ar1.sort(); // print the sorted array cout << "Sorted array ar1 contains " << ar1.getSize() << " values:" << endl; ar1.printArray(); // store the same data into ar2 and ar3 ar2.readFromFile("lab10b.data"); ar3.readFromFile("lab10b.data"); // print out the data in ar2 cout << "Array ar2 contains " << ar2.getSize() << " values:" << endl; ar2.printArray(); // Sort array ar3 ar3.sort(); // print the sorted array cout << "Sorted array ar3 contains " << ar3.getSize() << " values:" << endl; ar3.printArray(); // find where the value are now located in the sorted array cout << " Value Position in ar2 Position in ar3" << endl; cout << " ----- --------------- ---------------" << endl; for (i = 0; i < 10; i++) { pos = i * 2; if (pos < ar2.getSize()) { value = ar2.getValue (pos); newPos = ar3.find(value); cout << setw(10) << value << setw(20) << pos << setw(20) << newPos << endl; } } }