Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.16 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string.h>
  4. #include <conio.h>
  5. #include <Windows.h>
  6. #include <iomanip>
  7.  
  8. using namespace std;
  9.  
  10. struct NodeE{
  11. string *data[5];
  12. int amount; // so luong vd
  13. };
  14.  
  15. struct NodeM{
  16. string data;
  17. NodeM *pNext;
  18. };
  19.  
  20. struct ListMean{
  21. NodeM *pFirst;
  22. };
  23.  
  24. struct NodeW{
  25. string word;
  26. string type;
  27. ListMean mean;
  28. NodeE ex;
  29. };
  30.  
  31. struct NodeD{
  32. NodeW data;
  33. NodeD *pLeft;
  34. NodeD *pRight;
  35. };
  36.  
  37. struct HashTable{
  38. NodeD *pHead;
  39. NodeD *pTail;
  40. };
  41.  
  42. HashTable *Dic = new HashTable[26];
  43.  
  44. int HamBam(string str){
  45. return str[0]-97;
  46. }
  47.  
  48. void MakeHashTable(){
  49. for (int i = 0; i < 26; i++){
  50. Dic[i].pHead == NULL;
  51. Dic[i].pTail == NULL;
  52. }
  53. }
  54.  
  55.  
  56. // Ham Do Hoa
  57. void SetColor(WORD color)
  58. {
  59. HANDLE hConsoleOutput;
  60. hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
  61. CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
  62. GetConsoleScreenBufferInfo(hConsoleOutput, &screen_buffer_info);
  63. WORD wAttributes = screen_buffer_info.wAttributes;
  64. color &= 0x000f;
  65. wAttributes &= 0xfff0;
  66. wAttributes |= color;
  67. SetConsoleTextAttribute(hConsoleOutput, wAttributes);
  68. }
  69. void gotoxy(int x, int y)
  70. {
  71. HANDLE hConsoleOutput;
  72. COORD Cursor_an_Pos = { x, y };
  73. hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
  74. SetConsoleCursorPosition(hConsoleOutput, Cursor_an_Pos);
  75. }
  76. void textcolor(int x)
  77. {
  78. HANDLE mau;
  79. mau = GetStdHandle(STD_OUTPUT_HANDLE);
  80. SetConsoleTextAttribute(mau, x);
  81. }
  82. void ShowCur(bool CursorVisibility)
  83. {
  84. HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
  85. CONSOLE_CURSOR_INFO cursor = { 1, CursorVisibility };
  86. SetConsoleCursorInfo(handle, &cursor);
  87. }
  88. void Ve_Vien_Doi( int X, int Y, int cr, int cd1, int cd2, string TEXT){
  89. int Y1 = Y, Y2 = Y;
  90. for (int i = 0; i < cd1; i++){
  91. gotoxy(X,Y);
  92. for (int j = 0; j < cr; j++){
  93. if (i == 0 && j == 0)
  94. cout << char(201);
  95. else if (i == 0 && j == cr - 1)
  96. cout << char(187);
  97. else if (i == cd1 - 1 && j == 0)
  98. cout << char(200);
  99. else if (i == cd1 - 1 && j == cr - 1)
  100. cout << char(188);
  101. else if (i == 0 || i == cd1 - 1)
  102. cout << char(205);
  103. else if (j == 0 || j == cr- 1)
  104. cout << char(186);
  105. else
  106. cout << " ";
  107. }
  108. Y++;
  109. }
  110. for (int i = 0; i < cd2; i++){
  111. gotoxy(X, Y1 + cd1 - 1);
  112. for (int j = 0; j < cr; j++){
  113. if (i == 0 && j == 0)
  114. cout << char(204);
  115. else if (i == 0 && j == cr - 1)
  116. cout << char(185);
  117. else if (i == cd2 - 1 && j == 0)
  118. cout << char(200);
  119. else if (i == cd2 - 1 && j == cr - 1)
  120. cout << char(188);
  121. else if (i == 0 || i == cd2 - 1)
  122. cout << char(205);
  123. else if (j == 0 || j == cr- 1)
  124. cout << char(186);
  125. else
  126. cout << " ";
  127. }
  128. Y1++;
  129. }
  130. int s = TEXT.length();
  131. gotoxy(X + (cr - s)/2, (Y2 + cd1/2));
  132. cout << TEXT;
  133. }
  134. void viet(int x, int y, int z)
  135. {
  136. gotoxy(x,y);
  137. printf("%c",z);
  138. }
  139.  
  140. void vietchuoi(int x, int y, char s[], int mau){
  141. gotoxy(x,y);
  142. textcolor(mau);
  143.  
  144. }
  145. void bangmenu(int x, int y, int m, int n, int mau){
  146. int i,j;
  147. textcolor(mau);
  148. for (i = x; i <= x + m; i++){
  149. for(j = y; j <= y + n; j++){
  150. if(i == x || i == x + m){
  151. if(j == y && i != x + m)
  152. viet(i, j, 218);
  153. else if( j == y && i != x)
  154. viet(i, j, 191);
  155. else if( j == y + n && i != x + m)
  156. viet(i, j, 192);
  157. else if( j == y + n && i != x)
  158. viet(i, j, 217);
  159. else
  160. viet(i, j, 179);
  161. }
  162. else if(j == y || j == y + n)
  163. viet(i, j, 196);
  164. }
  165. }
  166. }
  167.  
  168.  
  169. void tbmenu(int x, int y){
  170. int i, j;
  171. for (i = x; i <= x + 80; i++){
  172. for (j = y; j <= y + 25; j++){
  173. if (i == x || i == x + 30 || i == x + 80){
  174. if (j == y && i != x && i != x + 80)
  175. viet(i, j, 203);
  176. else if (j == y && i != x + 80)
  177. viet(i, j, 201);
  178. else if (j == y && i != x)
  179. viet(i, j, 187);
  180. else if (j == y + 25 && i != x && i != x + 80)
  181. viet(i, j, 202);
  182. else if (j == y + 25 && i != x + 80)
  183. viet(i, j, 200);
  184. else if (j == y + 25 && i != x)
  185. viet(i, j, 188);
  186. else if (j == y + 4 && i != x + 30 && i != x + 80)
  187. viet(i, j, 204);
  188. else if (j == y + 4 && i != x && i != x + 30)
  189. viet(i, j, 185);
  190. else if (j == y + 4 && i != x && i != x + 80)
  191. viet(i, j, 206);
  192. else
  193. viet(i, j, 186);
  194. }
  195. else if (j == y || j == y + 25 || j == y + 4)
  196. viet(i, j, 205);
  197. }
  198. }
  199. }
  200.  
  201. void menuthemtu(int x, int y){
  202. int i,j;
  203. for (i = x; i <= x + 80; i++){
  204. for (j = y; j <= y + 25; j++){
  205. if (i == x || i == x + 80){
  206. if (j == y && i != x + 80)
  207. viet(i, j, 201);
  208. else if (j == y && i != x)
  209. viet(i, j, 187);
  210. else if (j == y + 25 && i != x && i != x + 80)
  211. viet(i, j, 202);
  212. else if (j == y + 25 && i != x + 80)
  213. viet(i, j, 200);
  214. else if (j == y + 25 && i != x)
  215. viet(i, j, 188);
  216. else
  217. viet(i, j, 186);
  218. }
  219. else if (j == y || j == y + 25)
  220. viet(i, j, 205);
  221. }
  222. }
  223.  
  224. }
  225. void menumain(){
  226. int x, y;
  227. bangmenu(37,1,67,2,15); //doi mau tieu de
  228. textcolor(15); // doi mau khung menu
  229. tbmenu(x = 30, y = 6);
  230. textcolor(15);
  231. menuthemtu(x = 30, y = 6);
  232. gotoxy(x+5, y+26);
  233. cout << endl;
  234. }
  235. int main()
  236. {
  237.  
  238. menumain();
  239.  
  240. system ("pause");
  241. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement