Advertisement
huutho_96

code mẫu

Jun 11th, 2015
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. using namespace std;
  4. //
  5. //
  6. //struct Data
  7. //{
  8. //  float dtb;
  9. //  char ten[30], mssv[10], tn[10];
  10. //};
  11. //struct Node
  12. //{
  13. //  Data info;
  14. //  char c;
  15. //  Node *pNext;
  16. //};
  17. //
  18. //struct List
  19. //{
  20. //  Node *pHead, *pTail;
  21. //};
  22. //
  23. //
  24. //int DeleteNode(List &L, Node *pDel)
  25. //{
  26. //  if (L.pHead == NULL) return 0;
  27. //
  28. //  Node *p = L.pHead, *pBef = NULL;
  29. //
  30. //  while (p && p != pDel)
  31. //  {
  32. //      pBef = p;
  33. //      p = p->pNext;
  34. //  }
  35. //
  36. //  if (!p) return 0;
  37. //
  38. //  if (L.pHead == L.pTail)
  39. //  {
  40. //      L.pTail = L.pHead = NULL;
  41. //      delete p;
  42. //      return 1;
  43. //  }
  44. //  if (p == L.pHead)
  45. //  {
  46. //      L.pHead = p->pNext;
  47. //      delete p;
  48. //      return 1;
  49. //  }
  50. //  if (p == L.pTail)
  51. //  {
  52. //      L.pTail = pBef;
  53. //      pBef->pNext = NULL;
  54. //      delete p;
  55. //      return 1;
  56. //  }
  57. //
  58. //  pBef->pNext = p->pNext;
  59. //  delete p;
  60. //  return 1;
  61. //}
  62. //
  63. //void AddHead(List &L, Node *p)
  64. //{
  65. //  if (L.pHead == NULL)
  66. //  {
  67. //      L.pHead = L.pTail = p;
  68. //  }
  69. //  else
  70. //  {
  71. //      p->pNext = L.pHead;
  72. //      L.pHead = p;
  73. //  }
  74. //}
  75. //Node *CreateNode(Data x)
  76. //{
  77. //  Node *p = new Node;
  78. //  if (!p) exit(1);
  79. //  p->info = x;
  80. //  p->pNext = NULL;
  81. //  return p;
  82. //}
  83. //
  84. //void AddTail(List &L, Node *p)
  85. //{
  86. //  if (L.pHead == NULL)
  87. //  {
  88. //      L.pHead = L.pTail = p;
  89. //  }
  90. //  else
  91. //  {
  92. //      L.pTail->pNext = p;
  93. //      L.pTail = p;
  94. //  }
  95. //}
  96. //
  97. //void Input(List &L)
  98. //{
  99. //  Data x;
  100. //  int c;
  101. //  do
  102. //  {
  103. //      fflush(stdin);
  104. //      cout << "ma so: ";
  105. //      cin.getline(x.mssv, 10);
  106. //      cout << "ten: ";
  107. //      cin.getline(x.ten, 30);
  108. //
  109. //      cout << "tiep tuc Enter: \n";
  110. //      AddHead(L, CreateNode(x));
  111. //      c = getch();
  112. //      if (c != 13) break;
  113. //
  114. //  } while (1);
  115. //}
  116. //
  117. //void AddOrder(List &L, Node *pAdd)
  118. //{
  119. //  Node *p = L.pHead, *pBef = NULL;
  120. //  while (p != NULL && p->info.dtb >= pAdd->info.dtb)
  121. //  {
  122. //      pBef = p;
  123. //      p = p->pNext;
  124. //  }
  125. //
  126. //  if (pBef == NULL)
  127. //  {
  128. //      AddHead(L, pAdd);
  129. //      return;
  130. //  }
  131. //
  132. //  if (p == NULL)
  133. //  {
  134. //      AddTail(L, pAdd);
  135. //      return;
  136. //  }
  137. //
  138. //  pBef->pNext = pAdd;
  139. //  pAdd->pNext = p;
  140. //}
  141. //void XepLoai(List L)
  142. //{
  143. //  Node *p = L.pHead;
  144. //  while (p)
  145. //  {
  146. //      if (p->info.dtb >= 9.0) p->c = 'X';
  147. //      if (p->info.dtb >= 8.0 && p->info.dtb < 9.0) p->c = 'G';
  148. //      if (p->info.dtb >= 7.0 && p->info.dtb < 8.0) p->c = 'K';
  149. //      if (p->info.dtb >= 5.0 && p->info.dtb < 7.0) p->c = 'T';
  150. //      if (p->info.dtb < 9.0) p->c = 'Y';
  151. //      p->pNext;
  152. //  }
  153. //}
  154. //
  155. //void XoaYeu(List &L)
  156. //{
  157. //  Node *p = L.pHead;
  158. //  Node *pBef = NULL;
  159. //  while (p != NULL)
  160. //  {
  161. //      pBef = p;
  162. //      if (p->c == 'Y')
  163. //      {
  164. //          DeleteNode(L, p);
  165. //          p = pBef;
  166. //      }
  167. //      else
  168. //          p = p->pNext;
  169. //  }
  170. //}
  171. //void main()
  172. //{
  173. //
  174. //}
  175. ///////////////////////////////////////////////////////////
  176. //struct Node
  177. //{
  178. //  int x;
  179. //  Node *pLeft, *pRight;
  180. //};
  181. //
  182. //typedef Node * Tree;
  183. //
  184. //void DemNodeLa(Tree T, int &dem)
  185. //{
  186. //  //LRN
  187. //  if (T)
  188. //  {
  189. //      //de quy trai
  190. //      DemNodeLa(T->pLeft, dem);
  191. //      //de quy phai
  192. //      DemNodeLa(T->pRight, dem);
  193. //      //xu li
  194. //      if (T->pRight == NULL && T->pLeft == NULL) dem += 1;
  195. //  }
  196. //}
  197. //Node *Search(Tree T, int x)
  198. //{
  199. //  //N (L || R)
  200. //  if (T)
  201. //  {
  202. //      if (T->x == x) return T;
  203. //      if(T->x > x) return Search(T->pLeft, x);
  204. //      else return Search(T->pRight, x);
  205. //  }
  206. //  return NULL;
  207. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement