在c#语句转换为if else 结构: void scoresort() { for (int i = 0; i < 5; i++) for (int j = 1; j < 4 - i; j++) { if (mya[j, 4] > mya[j + 1, 4]) { for (int k = 0; k < 5; k++) { int temp = mya[j, k]; mya[j, k] = mya[j + 1, k]; mya[j + 1, k] = temp; } } } }
时间: 2024-02-11 09:11:41 浏览: 65
已经给出了C#语句,这里重复一下:
```
void scoresort()
{
for (int i = 0; i < 5; i++)
for (int j = 1; j < 4 - i; j++)
{
if (mya[j, 4] > mya[j + 1, 4])
{
for (int k = 0; k < 5; k++)
{
int temp = mya[j, k];
mya[j, k] = mya[j + 1, k];
mya[j + 1, k] = temp;
}
}
}
}
```
转换为if else结构后:
```
void scoresort()
{
for (int i = 0; i < 5; i++)
{
for (int j = 1; j < 4 - i; j++)
{
if (mya[j, 4] > mya[j + 1, 4])
{
for (int k = 0; k < 5; k++)
{
int temp = mya[j, k];
mya[j, k] = mya[j + 1, k];
mya[j + 1, k] = temp;
}
}
else
{
// do nothing
}
}
}
}
```
阅读全文