1163 Problem L "C Programming Language" Jiang Po Kushiro Editor - Exercises 4-3- alphabetical order

Problem Description

Three input letters, alphabetical three letters sequentially outputs

Entry

Three letters

Export

Output alphabetically

Sample input

cba

Sample Output

abc

AC Code

#include <iostream>
#include<algorithm>

using namespace std;

int main()
{
    char a[3];
    for(int i = 0; i < 3; i++)
    {
        cin >> a[i];
    }
    sort(a,a+3);
    for(int j = 0; j < 3; j++)
    {
        cout << a[j];
    }
    return 0;
}

Published 119 original articles · won praise 28 · views 40000 +

Guess you like

Origin blog.csdn.net/weixin_41179709/article/details/103956744