Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
- void show(int* a, int len, int l, int r) {
- system("CLS");
- int max = a[0], min = a[0];
- for (int q = 0; q < len; q++) {
- if (a[q] < min) {
- min = a[q];
- }
- if (a[q] > max) {
- max = a[q];
- }
- }
- if (min > 0) min = 0;
- for (int q = 0; q < (-1) * min + max + 1; q++) {
- for (int i = 0; i < len; i++) {
- if (i == l || i == r) SetConsoleTextAttribute(console,10);
- else SetConsoleTextAttribute(console, 1);
- if (q < max) {
- if ((max - q) <= a[i]) printf("|");
- else printf(" ");
- }
- else if (q == max) {
- printf(".");
- }
- else {
- if (max - q >= a[i]) printf("|");
- else printf(" ");
- }
- }
- printf("\n");
- }
- SetConsoleTextAttribute(console, 1);
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement