内容纲要
#include <iostream>
using namespace std;

int main()
{
    //用选择法对10个整数排序
    int seconda[10] = { 0, 1, 2, 9, 3, 4, 5, 6, 7, 8 };
    int secondb[10];

    for (int i = 0; i < 10; i++)
    {
        int min = seconda[9];
        for (int j = 0; j < 10; j++)
        {
            if (seconda[j] <= min && seconda[j]>secondb[i-1])
            {
                min = seconda[j];
            }
        }
        secondb[i] = min;
    }
    for (int i = 0; i < 10; i++)
    {
        cout << secondb[i] << endl;
    }
    system("pause");
}

1 对 “7-30 二维数组作业”的想法;

发表评论