#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
void my_sort(char *a)
{
int len = strlen(a);
int temp = 0;
for (int i = 0; i < len; ++i) {
for (int j = i + 1; j < len; ++j) {
if (a[i] > a[j]) {
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
}
int main()
{
cout << "input T:";
int T;
cin >> T;
char **p = new char *[T];
for (int i = 0; i <= T; ++i) {
*(p + i) = new char[100];
gets(*(p + i));
my_sort(*(p + i));
}
for (int j = 0; j <= T; ++j) {
cout << *(p + j) << endl;
}
return 0;
}
输入字符串按照ansi码表排序(考虑字母重复)
最新推荐文章于 2022-05-10 21:54:01 发布