一组字符串按字典顺序输出

发布时间:2013-06-22 14:30:10   来源:文档文库   
字号:

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》
将本文的Word文档下载到电脑,方便收藏和打印
推荐度:
点击下载文档

文档为doc格式