19电气李欣


私信TA

用户名:15575444261

访问量:11320

签 名:

让回忆纪念最初的感动

等  级
排  名 1275
经  验 2914
参赛次数 1
文章发表 14
年  龄 19
在职情况 学生
学  校 湖南理工学院
专  业 电气工程及其自动化

  自我简介:

c语言萌新

 

0.0分

3 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

代码有点啰嗦。
    int indexMini; // index of current Minimum number
    for (int i = 0; i < 3; i++) // we need only first 3 numbers. Thinking of Selection Sort
    {
        indexMini = i;
        for (int j = i + 1; j < nLength; j++ )
        {
            if (array[j] < array[indexMini]) // Try to find minimum number
             indexMini = j;
        }
        
        swap(&array[i], &array[indexMini]);
        
        if (i == 2)
            printf("%d", array[i]);
        else
            printf("%d ", array[i]);
    }
2020-07-09 23:17:21
  • «
  • 1
  • »