<img src="http://img.blog.csdn.net/20140626095740421?
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveG1oMTk1NA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast” alt=””>
源程序:
#include<iostream> #include<string> using namespace std; //const int max=1024; int main() { char s[1024]; char temp; gets(s); int len; len=strlen(s); for(int i=0;i<len;i++) { for(int j=i+1;j<len;j++) { if(s[i]>s[j]) { temp=s[i];s[i]=s[j];s[j]=temp; } } } puts(s); return 0; }
执行结果:
<img src="http://img.blog.csdn.net/20140626100016781?
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveG1oMTk1NA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast” alt=””>
总结:非常easy~0基地称号~
版权声明:本文博客原创文章,博客,未经同意,不得转载。