这是题目:
#include <iostream>
using namespace std;
int main()
{
int a[10];
bool flag1[10] = { false ,false ,false ,false ,false ,false ,false ,false ,false ,false };
bool flag2[10] = { false ,false ,false ,false ,false ,false ,false ,false ,false ,false };
int odd[10] = { 0,0,0,0,0,0,0,0,0,0 }, even[10] = { 0,0,0,0,0,0,0,0,0,0 };
for (int i = 0; i < 10; i++)
{
cin >> a[i];
if (a[i] % 2 == 0)
{
flag1[i] = true;
even[i] = a[i];
}
else
{
flag2[i] = true;
odd[i] = a[i];
}
}
for (int i = 0; i < 10 - 1; i++)
{
for (int j = 0; j < 10 - i - 1; j++)
{
if (even[j] > even[j + 1] && flag1[j] == true && flag1[j + 1] == true)
{
int temp1 = even[j];
even[j] = even[j + 1];
even[j + 1] = temp1;
}
}
}
for (int i = 0; i < 10 - 1; i++)
{
for (int j = 0; j < 10 - i - 1; j++)
{
if (odd[j] < odd[j + 1] && flag2[j] == true && flag2[j + 1] == true)
{
int temp2 = odd[j];
odd[j] = odd[j + 1];
odd[j + 1] = temp2;
}
}
}
for (int i = 0; i < 10; i++)
{
if (flag2[i])
{
cout << odd[i] << " ";
}
}
for (int i = 0; i < 10; i++)
{
if (flag1[i])
{
cout << even[i] << " ";
}
}
return 0;
}
请问有问题吗?