Skip to content

push homework 6 clean#7

Merged
nedav347 merged 1 commit into
mainfrom
lesson_6_
May 23, 2021
Merged

push homework 6 clean#7
nedav347 merged 1 commit into
mainfrom
lesson_6_

Conversation

@nedav347

Copy link
Copy Markdown
Owner

homework 6_

Comment thread lesson6_1/lesson6.c
printf("%s%d\n", "Введите элемент ", i);
fflush(stdout);
scanf("%lf", &S[i]);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

если я ничего не путаю вот тут должна быть инверсия последовательности

Comment thread lesson6_1/lesson6.c
Comment on lines +43 to +56
void bubble(int (*arr)[SIZE_Y]) {
int tmp;
for (int i = 0; i < SIZE_X; ++i) {
for (int j = 0; j < SIZE_Y; ++j) {
for (int k = 0; k < SIZE_X; ++k) {
for (int m = 0; m < SIZE_Y; ++m) {
if (arr[i][j] < arr[k][m]) {
swap(&arr[i][j], &arr[k][m]);
}
}
}
}
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

громозкий код, по факту делающий довольно простую вещь - проверяет выход за пределы массива.
на деле это можно сократить просто правильно посчитав индексы проверки

@nedav347 nedav347 merged commit ac9ab2a into main May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants