This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: , which will represent the number of elements in the array to use. 3. Fill the array, from index to arraySize , with random numbers (for a refresher on how to do this, consult Lab 5, dont forget to include the necessary libraries!). 4. Output these numbers to the screen in unsorted order. 5. Write an algorithm to sort these numbers, using Algorithm 1 as a guide. a. This step will involve you having to write a function that swaps two values (for use at Line A in Algorithm 1). Use the following function template: void swap(double& a, double& b) { // Create a temporary variable, tmp // Put a into tmp // Put b into a // Put tmp into b } This function is being passed two values by reference . That means, when you modify these arguments, you are modifying the values passed into the function directly. 6. Output these numbers to the screen in sorted order. 7. Turn in a printed copy of your source code with your name on it....
View Full
Document
 Spring '09
 ALL
 Sort

Click to edit the document details