1205:ASCLL码排序
来源:互联网 发布:c语言字符串最前面是0 编辑:程序博客网 时间:2024/05/16 15:27
1205:ASCLL码排序
Description
输入三个字符(可以重复)后,按各字符的ASCLL码从小到大的顺序输出这三个字符。
Input
第一行输入一个数N,表示有N组测试数据,后面的N行输入多组数据,每组输入数据都是占一行,有三个字符组成,之间无空格。
Output
对于每组输入数据,输出一行,字符中间用一个空格分开。
Sample Input
3
qwe
asd
zxc
Sample Output
e q w
a s d
c x z
#include<iostream>#include<string>using namespace std;int main(){ int N,i,j; string ch; cin>>N;while(N--) { cin>>ch; int temp,index,k; for(k=0;k<2;k++) { index=k; for(j=k+1;j<3;j++) { if(ch[j]<ch[index]) { index=j; } } if(index!=k) { temp=ch[k];ch[k]=ch[index];ch[index]=temp; } } cout<<ch[0]; for(i=1;i<3;i++) { cout<<" "<<ch[i]; }cout<<endl; }return 0;}
阅读全文
0 0
- 1205:ASCLL码排序
- NYOJ - ASCLL码排序
- ASCLL码排序
- ASCLL码排序
- Ascll码排序
- ASCLL码排序STL
- HPU ascll 码排序
- ASCLL排序
- ASCLL码
- ASCLL码
- hduoj2000(ASCll排序)
- 键盘的ASCll码
- ASCll码对照表
- 一些ASCLL码
- 初遇ASCLL码
- 键盘ascll码
- 10-Ascll码排列
- ASCll码对照表
- 在Android中使用Base64上传图片
- 时间工具类
- Python 输出JSON对象数组&写入数据到MySQL
- C++中类所占内存空间大小C++中类所占内存空间大小
- Andrew NG 机器学习 练习3-Multiclass Classification and Neural Networks
- 1205:ASCLL码排序
- 树莓派 Samba共享文件
- expect
- 九度[1012]-畅通工程
- 新的开始
- Cloud Native Java-OReilly 2017 读书笔记
- [js高手之路] 我的开源javascript框架gdom
- 简单介绍Java ClassLoader
- tensorflow官网无法访问