// algorithum.cpp : Defines the entry point for the console application. // #include "tchar.h" #include //#define TEST_QUICK_SORT //#define TEST_MATRIX_TRANSFORM #define TEST_LINKED_NODE //#define TEST_STRING_UTIL #ifdef TEST_QUICK_SORT #include "quick_sort.h" #endif #ifdef TEST_MATRIX_TRANSFORM #include "matrix_transform.h" #endif #ifdef TEST_LINKED_NODE #include "linked_node.h" #endif #ifdef TEST_STRING_UTIL #include "string_util.h" #endif int _tmain(int argc, _TCHAR* argv[]) { #ifdef TEST_QUICK_SORT int a[] = { 9, 8 ,4, 3, 1, 2, 10, 5, 7, 6 }; int len = sizeof(a) / sizeof(int); for (int i = 0; i < len; ++i) std::cout<(a, 0, len - 1); for (int i = 0; i < len; ++i) std::cout<value = -1; a->next = NULL; pLinkNode A = a; for (int i = 0; i < 5; ++i) { pLinkNode b = new LinkNode; b->next = NULL; b->value = i; std::cout<value<<','; a->next = b; a = b; } std::cout<value = -1; b->next = NULL; pLinkNode B = b; for (int i = 0; i < 5; ++i) { pLinkNode c = new LinkNode; c->next = NULL; c->value = i + 2; std::cout<value<<','; b->next = c; b = c; } std::cout<next; ++i, A = A->next) std::cout<next->value<<','; std::cout<value = -1; l->next = NULL; pLinkNode L = l; // copy the head node position for (int i = 0; i < 5; ++i) { pLinkNode t = new LinkNode; t->value = i; t->next = NULL; l->next = t; l = t; } //l->next = L; std::cout<<(ring(L) ? "has a ring" : "not a ring" )<value = 1; m->next = NULL; pLinkNode n = new LinkNode; n->value = 0; n->next = m; //m->next = n; std::cout<<(ring(m) ? "has a ring" : "not a ring") <value<value = -1; root->next = NULL; pLinkNode head = root; for (int i = 0; i < 5; ++i) { pLinkNode t = new LinkNode; t->value = i; t->next = NULL; root->next = t; root = t; } head = reverse(head); #endif #ifdef TEST_STRING_UTIL std::cout << contains_char("!@#$%^& ))", " ") <