Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Ashley Jerome
- //CIS362
- //HW1
- //2.13.12
- //Compare performance of SelectionSort and MergeSort
- //TODO
- //Prompt user for number of integers to be sorted
- //construct vector of random integers
- //perform each sort on the vector
- //find time each sort takes using clock function in ctime library
- //display time for each sort in a readable format
- #include <stdio.h>
- #include <time.h>
- int main()
- {
- int numInts;
- int i;
- printf("Please enter the number of integers to be sorted\n");
- //store number in numInts
- scanf("%d", &numInts);
- //handle enter pressed
- getchar();
- //create array of numInts integers
- int integers[numInts];
- //random generator
- srand(time(NULL));
- for(i=0;i<numInts;i++);
- {
- integers[i]=rand();
- }
- for(i=0;i<numInts;i++);
- {
- printf("%d \n", integers[i]);
- }
- }
Add Comment
Please, Sign In to add comment