wordpress机械行业模板/网站内容优化怎么去优化呢
Description
输入3个字符串,按字典序从小到大进行排序。
Input
输入数据有一行,分别为3个字符串,用空格分隔,每个字符串长度不超过100。
Output
输出排序后的三个字符串,用空格分隔。
Sample
Input
abcd cdef bcde
Output
abcd bcde cdef
实现
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{int i, j, n = 3, min;char str[3][101], t[100];scanf("%s %s %s", str[0], str[1], str[2]);for(i = 0; i < n - 1; i++){min = i;for(j = i + 1; j < n; j++){if(strcmp(str[j], str[min]) < 0)min = j;}strcpy(t, str[i]);strcpy(str[i], str[min]);strcpy(str[min], t);}printf("%s %s %s", str[0], str[1], str[2]);return 0;
}