1. 将一组字符串按字典顺序输出。(通过函数调用完成)
程序源代码:
#include
#include
//进行值得交换
void swap(char c[],int length){
int i,j;
char temp;
for(i=0;i
for(j=i+1;j
if((c[i]-c[j])>0){
temp=c[i];
c[i]=c[j];
c[j]=temp;
}
}
}
}
int main(){
char c[100];
printf("请输入一窜字符:\n");
gets(c);
swap(c,strlen(c));
puts(c);
return 0;
}
程序的运行结果(I/O窗口截图)
本文来源:https://www.2haoxitong.net/k/doc/d471555be518964bcf847cac.html
文档为doc格式