文件名称:as
介绍说明--下载内容均来自于网络,请自行研究使用
本程序首先对数组a中的10个数从大到小排序并输出排序结果。然后输入要插入的整数n。再用一个for语句把n和数组元素逐个比较,如果发现有n>a[i]时,则由一个内循环把i以下各元素值顺次后移一个单元。后移应从后向前进行(从a[9]开始到a[i]为止)。后移结束跳出外循环。插入点为i,把n赋予a[i]即可。 如所有的元素均大于被插入数,则并未进行过后移工作。此时i=10,结果是把n赋于a[10]。最后一个循环输出插入数后的数组各元素值。
-This procedure first array of a number of the 10 smallest sort and output the results. And then type to insert an integer n. Use a for statement to n and the array element-by-comparison, and if there are n> a [i] when a loop from the i following sequential elements in the value of a unit after the transfer. After the shift should be carried out after the move (from a [9] start to a [i] so far). Moved out after the end of outer circle. Insertion point for the i, to n to give a [i] can be. If all the elements to be inserted more than a few, it has not been carried out after the work shift. At this point i = 10, the result is n giving a [10]. The last cycle of the output of the array after inserting a few values of each element.
-This procedure first array of a number of the 10 smallest sort and output the results. And then type to insert an integer n. Use a for statement to n and the array element-by-comparison, and if there are n> a [i] when a loop from the i following sequential elements in the value of a unit after the transfer. After the shift should be carried out after the move (from a [9] start to a [i] so far). Moved out after the end of outer circle. Insertion point for the i, to n to give a [i] can be. If all the elements to be inserted more than a few, it has not been carried out after the work shift. At this point i = 10, the result is n giving a [10]. The last cycle of the output of the array after inserting a few values of each element.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
as.doc