您的位置:首页 > 其它

Asc码排序,冒泡排序

2013-08-12 16:53 148 查看
#include <iostream>

using namespace std;

int main(){

int count1 = 0;

int count2;

char Insert;

char mAsc[3]="";

cin >> count1;

while (count1--)

{

count2 = 3;

while (count2--)

{

cin >> mAsc[count2];

}

//简单的冒泡排序

for (int i=0;i<3;i++)

{

for (int j=i+1;j<3;j++)

{

if (mAsc[i]>mAsc[j])

{

Insert = mAsc[i];

mAsc[i] = mAsc[j];

mAsc[j]=Insert;

}

}

}

for (int m=0;m<3;m++)

{

cout << mAsc[m] << " ";

}

cout <<endl;

}

return true;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐