Hot Search : Source embeded web remote control p2p game More...
Location : Home Search - sort st
Search - sort st - List
DL : 0
这个双重循环完成按字母顺序排序的工作。在外层循环中把字符数组cs[i]中的国名字符串拷贝到数组st中,并把下标i赋予P。进入内层循环后,把st与cs[i]以后的各字符串作比较,若有比st小者则把该字符串拷贝到st中,并把其下标赋予p。内循环完成后如p不等于i说明有比cs[i]更小的字符串出现,因此交换cs[i]和st的内容。至此已确定了数组cs的第i号元素的排序值。然后输出该字符串。在外循环全部完成之后即完成全部排序和输出。-The double circle in alphabetical order to complete the work order. In the outer circle of the character array cs [i] in the name of the string copied to the array of st, and the subscript i given P. After entering the inner circle, the st and cs [i] after the string to compare, if slightly smaller than st copy of the string to the st, and given its subscript p. After the completion of internal circulation, such as p does not mean that i stated that there were more than cs [i] string appear smaller, so the exchange of cs [i] and the content of st. This has identified cs array element i of the first sort value. And then output the string. Outer circle that is completed after the completion of all the sorting and output.
Date : 2025-12-27 Size : 3kb User : lili
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.