#include <stdio.h>#include <string.h>int main(){char string[10][50], temp[50];printf("请输入6个单词:\n");for(int i = 0; i < 6; i++)scanf("%s", string[i]);/*冒泡排序*/for(int i = 0; i < 5; i++ )for(int j = i+1; j < 6; j++)if(strcmp(string[i], string[j]) == 1)//比较字符串大小,可以用strcmp{strcpy(temp, string[i]) ;//交换要strcpystrcpy(string[i], string[j]) ;strcpy(string[j], temp) ;}//输出printf("输出排好序的6个单词:\n");for(int i = 0; i < 6; i++ )puts(string[i]);return 0;}