Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. void show(int* a, int len, int l, int r) {
  2. system("CLS");
  3. int max = a[0], min = a[0];
  4. for (int q = 0; q < len; q++) {
  5. if (a[q] < min) {
  6. min = a[q];
  7. }
  8. if (a[q] > max) {
  9. max = a[q];
  10. }
  11. }
  12. if (min > 0) min = 0;
  13. for (int q = 0; q < (-1) * min + max + 1; q++) {
  14. for (int i = 0; i < len; i++) {
  15. if (i == l || i == r) SetConsoleTextAttribute(console,10);
  16. else SetConsoleTextAttribute(console, 1);
  17. if (q < max) {
  18. if ((max - q) <= a[i]) printf("|");
  19. else printf(" ");
  20. }
  21. else if (q == max) {
  22. printf(".");
  23. }
  24. else {
  25. if (max - q >= a[i]) printf("|");
  26. else printf(" ");
  27. }
  28. }
  29. printf("\n");
  30. }
  31. SetConsoleTextAttribute(console, 1);
  32. system("PAUSE");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement