C语言:生成20个随机数,然后把它们排序,最后要把排序前和排序后的数都显示出来.原题是:Write a program that uses a list of 20 randomly generated numbers and put the list in order using a selection sort. Display both t
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/20 12:37:18
4N; 98+{29f2 hi4-A}c-8rCF8f0xG: D;Y:َК==f.N،I%9/W+~ցZYGB\b8/lTCi;n
C语言:生成20个随机数,然后把它们排序,最后要把排序前和排序后的数都显示出来.原题是:Write a program that uses a list of 20 randomly generated numbers and put the list in order using a selection sort. Display both t
C语言:生成20个随机数,然后把它们排序,最后要把排序前和排序后的数都显示出来.
原题是:Write a program that uses a list of 20 randomly generated numbers and put the list in order using a selection sort. Display both the initial list and the recorded list.
我用的软件是Win-TC.
写了好久只写出来怎么随机生成,好泄气,好想放弃了.
而且我连题目都看的不是很明白,不知道是不是理解错了.
#include
#include
#include
int main()
{ int nums[20],num[20];
int i;
srand(time(NULL));
for (i=1;i
C语言:生成20个随机数,然后把它们排序,最后要把排序前和排序后的数都显示出来.原题是:Write a program that uses a list of 20 randomly generated numbers and put the list in order using a selection sort. Display both t
#include
#include
#include
int main()
{
int nums[21],num[21]; /*你的角标从1开始,这里的20就不够了*/
int i,j;
int index,temp;
srand(time(NULL));
for (i=1;i