void milestone3() { std::cout << "*** MILESTONE 3" << std::endl; std::vector<int> numbers = random_numbers(20); std::vector<int> unsorted(numbers); BubbleSort(numbers); std::cout << "-->List of Random Numbers:" << std::endl; print_vector(unsorted); std::cout << "-->SORTED:" << std::endl; print_vector(numbers); }
void milestone1() { std::cout << "*** MILESTONE 1" << std::endl; std::vector<int> numbers = { 5, 1, 4, 2, 8 }; std::vector<int> unsorted(numbers); BubbleSort(numbers); std::cout << "Original List:" << std::endl; print_vector(unsorted); std::cout << "Sorted List:" << std::endl; print_vector(numbers); }
void DependencyResolverTest::operatorParensTest() { std::vector<std::string> unsorted(6); unsorted[0] = "c"; unsorted[1] = "f"; unsorted[2] = "a"; unsorted[3] = "d"; unsorted[4] = "b"; unsorted[5] = "e"; // Sort based on the dependency resolver // "bead" will come out after the independent items std::sort(unsorted.begin(), unsorted.end(), _strict_ordering); CPPUNIT_ASSERT( unsorted[2] == "b"); CPPUNIT_ASSERT( unsorted[3] == "e"); CPPUNIT_ASSERT( unsorted[4] == "a"); CPPUNIT_ASSERT( unsorted[5] == "d"); }
int main(int argc, char *argv[]){ int i; int arr[5] = {3, 5, 1, 2, 2}; /* unsorted array - feel free to change */ int sarr[5] = {1, 2, 2, 3, 5}; /* sorted array - feel free to change */ int l, u, s; /* l and u as stated in the description above. s is the size of the arrays */ /* usage */ if (argc < 4){ printf("usage: %s [l] [u]\n", argv[0]); printf("-s sorted range search\n"); printf("-u unsorted range search\n"); } else if (strcmp(argv[3], "-s") == 0){ s = sizeof(sarr) / sizeof(sarr[0]); /* lets grab the size of the sorted array */ sorted(sarr, atoi(argv[1]), atoi(argv[2]), s); /* send it to the "sorted array" function */ } else if (strcmp(argv[3], "-u") == 0){ s = sizeof(arr) / sizeof(arr[0]); /* lets grab the size of the unsorted array */ unsorted(arr, atoi(argv[1]), atoi(argv[2]), s); /* send it to the "unsorted array" function */ } return 0; }