Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string.h>
- #include <conio.h>
- #include <Windows.h>
- #include <iomanip>
- using namespace std;
- struct NodeE{
- string *data[5];
- int amount; // so luong vd
- };
- struct NodeM{
- string data;
- NodeM *pNext;
- };
- struct ListMean{
- NodeM *pFirst;
- };
- struct NodeW{
- string word;
- string type;
- ListMean mean;
- NodeE ex;
- };
- struct NodeD{
- NodeW data;
- NodeD *pLeft;
- NodeD *pRight;
- };
- struct HashTable{
- NodeD *pHead;
- NodeD *pTail;
- };
- HashTable *Dic = new HashTable[26];
- int HamBam(string str){
- return str[0]-97;
- }
- void MakeHashTable(){
- for (int i = 0; i < 26; i++){
- Dic[i].pHead == NULL;
- Dic[i].pTail == NULL;
- }
- }
- // Ham Do Hoa
- void SetColor(WORD color)
- {
- HANDLE hConsoleOutput;
- hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
- GetConsoleScreenBufferInfo(hConsoleOutput, &screen_buffer_info);
- WORD wAttributes = screen_buffer_info.wAttributes;
- color &= 0x000f;
- wAttributes &= 0xfff0;
- wAttributes |= color;
- SetConsoleTextAttribute(hConsoleOutput, wAttributes);
- }
- void gotoxy(int x, int y)
- {
- HANDLE hConsoleOutput;
- COORD Cursor_an_Pos = { x, y };
- hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- SetConsoleCursorPosition(hConsoleOutput, Cursor_an_Pos);
- }
- void textcolor(int x)
- {
- HANDLE mau;
- mau = GetStdHandle(STD_OUTPUT_HANDLE);
- SetConsoleTextAttribute(mau, x);
- }
- void ShowCur(bool CursorVisibility)
- {
- HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
- CONSOLE_CURSOR_INFO cursor = { 1, CursorVisibility };
- SetConsoleCursorInfo(handle, &cursor);
- }
- void Ve_Vien_Doi( int X, int Y, int cr, int cd1, int cd2, string TEXT){
- int Y1 = Y, Y2 = Y;
- for (int i = 0; i < cd1; i++){
- gotoxy(X,Y);
- for (int j = 0; j < cr; j++){
- if (i == 0 && j == 0)
- cout << char(201);
- else if (i == 0 && j == cr - 1)
- cout << char(187);
- else if (i == cd1 - 1 && j == 0)
- cout << char(200);
- else if (i == cd1 - 1 && j == cr - 1)
- cout << char(188);
- else if (i == 0 || i == cd1 - 1)
- cout << char(205);
- else if (j == 0 || j == cr- 1)
- cout << char(186);
- else
- cout << " ";
- }
- Y++;
- }
- for (int i = 0; i < cd2; i++){
- gotoxy(X, Y1 + cd1 - 1);
- for (int j = 0; j < cr; j++){
- if (i == 0 && j == 0)
- cout << char(204);
- else if (i == 0 && j == cr - 1)
- cout << char(185);
- else if (i == cd2 - 1 && j == 0)
- cout << char(200);
- else if (i == cd2 - 1 && j == cr - 1)
- cout << char(188);
- else if (i == 0 || i == cd2 - 1)
- cout << char(205);
- else if (j == 0 || j == cr- 1)
- cout << char(186);
- else
- cout << " ";
- }
- Y1++;
- }
- int s = TEXT.length();
- gotoxy(X + (cr - s)/2, (Y2 + cd1/2));
- cout << TEXT;
- }
- void viet(int x, int y, int z)
- {
- gotoxy(x,y);
- printf("%c",z);
- }
- void vietchuoi(int x, int y, char s[], int mau){
- gotoxy(x,y);
- textcolor(mau);
- }
- void bangmenu(int x, int y, int m, int n, int mau){
- int i,j;
- textcolor(mau);
- for (i = x; i <= x + m; i++){
- for(j = y; j <= y + n; j++){
- if(i == x || i == x + m){
- if(j == y && i != x + m)
- viet(i, j, 218);
- else if( j == y && i != x)
- viet(i, j, 191);
- else if( j == y + n && i != x + m)
- viet(i, j, 192);
- else if( j == y + n && i != x)
- viet(i, j, 217);
- else
- viet(i, j, 179);
- }
- else if(j == y || j == y + n)
- viet(i, j, 196);
- }
- }
- }
- void tbmenu(int x, int y){
- int i, j;
- for (i = x; i <= x + 80; i++){
- for (j = y; j <= y + 25; j++){
- if (i == x || i == x + 30 || i == x + 80){
- if (j == y && i != x && i != x + 80)
- viet(i, j, 203);
- else if (j == y && i != x + 80)
- viet(i, j, 201);
- else if (j == y && i != x)
- viet(i, j, 187);
- else if (j == y + 25 && i != x && i != x + 80)
- viet(i, j, 202);
- else if (j == y + 25 && i != x + 80)
- viet(i, j, 200);
- else if (j == y + 25 && i != x)
- viet(i, j, 188);
- else if (j == y + 4 && i != x + 30 && i != x + 80)
- viet(i, j, 204);
- else if (j == y + 4 && i != x && i != x + 30)
- viet(i, j, 185);
- else if (j == y + 4 && i != x && i != x + 80)
- viet(i, j, 206);
- else
- viet(i, j, 186);
- }
- else if (j == y || j == y + 25 || j == y + 4)
- viet(i, j, 205);
- }
- }
- }
- void menuthemtu(int x, int y){
- int i,j;
- for (i = x; i <= x + 80; i++){
- for (j = y; j <= y + 25; j++){
- if (i == x || i == x + 80){
- if (j == y && i != x + 80)
- viet(i, j, 201);
- else if (j == y && i != x)
- viet(i, j, 187);
- else if (j == y + 25 && i != x && i != x + 80)
- viet(i, j, 202);
- else if (j == y + 25 && i != x + 80)
- viet(i, j, 200);
- else if (j == y + 25 && i != x)
- viet(i, j, 188);
- else
- viet(i, j, 186);
- }
- else if (j == y || j == y + 25)
- viet(i, j, 205);
- }
- }
- }
- void menumain(){
- int x, y;
- bangmenu(37,1,67,2,15); //doi mau tieu de
- textcolor(15); // doi mau khung menu
- tbmenu(x = 30, y = 6);
- textcolor(15);
- menuthemtu(x = 30, y = 6);
- gotoxy(x+5, y+26);
- cout << endl;
- }
- int main()
- {
- menumain();
- system ("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement