1° 选择排序算法
核心思路如下图:
以字符串排序进行说明
#include <stdio.h> #include <string.h> #define SIZE 81 #define LIM 20 #define HALT " " void stsrt(char *strings[], int num); int main(void) { char input[LIM][SIZE]; char *ptstr[LIM]; int ct = 0; int k; printf("Input up %d lines, and I will sort them. ", LIM); printf("To stop, press the Enter key at a line's start. "); while(ct < LIM && gets(input[ct]) != NULL && input[ct][0] != '