Advertisement
Guest User

a

a guest
Nov 23rd, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. case на принт списка:
  2. if (!beg)
  3. {
  4. numberOfMessage = 1;
  5. counterMenu -= 0;
  6. continue;
  7. }
  8. else
  9. {
  10. system("cls");
  11. int depth = foundDepth(beg);
  12. int left_bound = 1;
  13. int right_bound = 7;
  14. key = 's';
  15. int pos = left_bound;
  16. cur = getElement(beg, 1);
  17. while (1)
  18. {
  19. system("cls");
  20. printList(cur, pos, left_bound, right_bound + 1);
  21.  
  22. key = _getch();
  23. if (key == 's' || key == 'S')
  24. pos += 1;
  25.  
  26. if (key == 'w' || key == 'W')
  27. pos-=1;
  28. if (key == '*')
  29. break;
  30. if (pos < left_bound && pos > 0)
  31. {
  32. left_bound -= 7;
  33. right_bound = left_bound + 6;
  34. cur = getElement(beg, left_bound);
  35. system("cls");
  36. }
  37. if (pos > right_bound && pos < depth)
  38. {
  39. left_bound = right_bound + 1;
  40. right_bound += 7;
  41. cur = getElement(beg, left_bound);
  42. system("cls");
  43. }
  44. if (pos > depth)
  45. pos = depth;
  46. if (pos < 1)
  47. pos = 1;
  48.  
  49.  
  50. }
  51. key = 's';
  52. break;
  53. }
  54. }
  55.  
  56. --------------------------------------------
  57.  
  58. int printList(list *beg, int pos, int left_bound, int right_bound)
  59. {
  60. if (!beg)
  61. return 0;
  62.  
  63. list *temp;
  64. temp = beg;
  65. int i = 1;
  66.  
  67. int counter = left_bound;
  68. while (temp && counter < right_bound)
  69. {
  70. print(*temp, i, counter, pos);
  71. temp = temp->right;
  72. i += 2;
  73. counter++;
  74. }
  75. + каркас таблицы
  76. }
  77.  
  78. ----------------------------------------------------
  79. печать одной записи
  80. ----------------------------------------------------
  81. void print(const list &info, int i, int counter, int position)
  82. {
  83. if (i == -1)
  84. printf("%-21s%-5s%-5s%-2s%-13s%-3s%-2s%-3s%-3s%-6s\n", info.data.name, info.data.t_number, info.data.birthday, info.data.gender, info.data.prof, info.data.exp, info.data.level, info.data.b_number, info.data.s_number, info.data.salary);
  85. else
  86. {
  87. if (position == counter)
  88. changeTextColor("red");
  89. //SetConsoleTextAttribute(hConsole, (WORD)((15 << 4) | 12));
  90. else
  91. changeTextColor("yellow");
  92. gotoxy(0, i + 3);
  93. printf(" %-4d%-21s%-6s%-7s%-3s%-14s%-5s%-4s%-4s%-4s%-6s\n", counter, info.data.name, info.data.t_number, info.data.birthday, info.data.gender, info.data.prof, info.data.exp, info.data.level, info.data.b_number, info.data.s_number, info.data.salary);
  94. SetConsoleCP(866);
  95. SetConsoleOutputCP(866);
  96. changeTextColor("lightblue");
  97. gotoxy(0, i + 3); cout << "\xBA";
  98. gotoxy(79, i + 3); cout << "\xBA";
  99. gotoxy(0, i + 4); cout << "\xCC";
  100. gotoxy(79, i + 4); cout << "\xB9";
  101. for (int j = 1; j < 79; j++)
  102. {
  103. gotoxy(j, i + 4);
  104. cout << "\xCD";
  105. if (j == 4 || j == 25 || j == 31 || j == 37 || j == 41 || j == 54 || j == 59 || j == 63 || j == 68 || j == 72)
  106. {
  107. gotoxy(j, i+3); cout << "\xBA";
  108. gotoxy(j, i+4); cout << "\xCE";
  109.  
  110. }
  111. }
  112. SetConsoleCP(1251);
  113. SetConsoleOutputCP(1251);
  114.  
  115. }
  116.  
  117. return;
  118. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement