练习一下冒泡排序
#include <cstdio>
#include <cstring>
int main()
{
char s[20];
int cnt = 0;
while (scanf("%s",s) != EOF)
{
for (int i = 0; i < strlen(s); ++i)
{
bool changed = false;
for (int j = 0; j < strlen(s) - 1; ++j)
{
if (s[j] > s[j+1])
{
char c = s[j];
s[j] = s[j+1];
s[j+1] = c;
c...
登录后发布评论
暂无评论,来抢沙发