Прокомментировать код - C# (193015)
Формулировка задачи:
Помогите закомментировать часть кода
for (int k = 0; k < MyText.Length - 1; k = k + 2) { for (i = 0; i < 10; i++) { for (j = 0; j < 16; j++) { if (Resh[i, j] == MyText[k]) { pos1[0] = i; pos1[1] = j; } if (Resh[i, j] == MyText[k + 1]) { pos2[0] = i; pos2[1] = j; } } } if (pos1[0] == pos2[0]) { if (pos1[1] < pos2[1]) ResText = ResText + Resh[pos1[0], (pos1[1] + 1) % 16] + Resh[pos2[0], (pos2[1] + 1) % 16]; else if (pos1[1] > pos2[1]) ResText = ResText + Resh[pos2[0], (pos1[1] + 1) % 16] + Resh[pos2[0], (pos2[1] + 1) % 16]; } else if (pos1[1] == pos2[1]) { if (pos1[0] < pos2[0]) ResText = ResText + Resh[(pos1[0] + 1) % 10, pos2[1]] + Resh[(pos2[0] + 1) % 10, pos2[1]]; else if (pos1[0] > pos2[0]) ResText = ResText + Resh[(pos1[0] + 1) % 10, pos1[1]] + Resh[(pos2[0] + 1) % 10, pos1[1]]; } else { ResText = ResText + Resh[pos1[0], pos2[1]] + Resh[pos2[0], pos1[1]]; } } }
Решение задачи: «Прокомментировать код»
textual
Листинг программы
/* for (int k = 0; k < MyText.Length - 1; k = k + 2) { for (i = 0; i < 10; i++) { for (j = 0; j < 16; j++) { if (Resh[i, j] == MyText[k]) { pos1[0] = i; pos1[1] = j; } if (Resh[i, j] == MyText[k + 1]) { pos2[0] = i; pos2[1] = j; } } } if (pos1[0] == pos2[0]) { if (pos1[1] < pos2[1]) ResText = ResText + Resh[pos1[0], (pos1[1] + 1) % 16] + Resh[pos2[0], (pos2[1] + 1) % 16]; else if (pos1[1] > pos2[1]) ResText = ResText + Resh[pos2[0], (pos1[1] + 1) % 16] + Resh[pos2[0], (pos2[1] + 1) % 16]; } else if (pos1[1] == pos2[1]) { if (pos1[0] < pos2[0]) ResText = ResText + Resh[(pos1[0] + 1) % 10, pos2[1]] + Resh[(pos2[0] + 1) % 10, pos2[1]]; else if (pos1[0] > pos2[0]) ResText = ResText + Resh[(pos1[0] + 1) % 10, pos1[1]] + Resh[(pos2[0] + 1) % 10, pos1[1]]; } else { ResText = ResText + Resh[pos1[0], pos2[1]] + Resh[pos2[0], pos1[1]]; } } } */
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д