【发布时间】:2021-02-11 19:25:36
【问题描述】:
我正在努力解决这个问题:
- 1 10
- 2 9
- 3 8
- 4 7
- 5 6
我该怎么做?
我的代码:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
const int n=10;
int Tab[n]={1,2,3,4,5,6,7,8,9,10};
for(int i=0; i<5; i++)
for(int j=5; j>=0; j--)
cout << Tab[i] << " " << Tab[j] << endl;
return 0;
}
【问题讨论】:
-
你的问题是什么?
-
你的数组已经排好序了,不需要再排序了。
-
不是2 9, 3 8, 4 7, 5 6
-
是的,因为在您建议的输出中您跳过了 9 但不清楚原因
-
@Slava 我弄错了。我的错。