Traditional Culture Encyclopedia - Photography and portraiture - C language writes a function to sort the input 10 characters from large to small by "bubble method"

C language writes a function to sort the input 10 characters from large to small by "bubble method"

Written in VC:

# contains "iostream.h"

Major (invalid)

{

int i,j;

int t[ 10];

Cout & lt& lt Please enter 10 digits:;

for(I = 0; I< 10; i++)

CIN & gt; & gtt[I];

for(I = 0; I<9; i++)

{

k = t[I];

for(j = I+ 1; j & lt 10; j++)

if(t[j]& lt; k)k = t[j];

If (k! = t[I])t[j]= t[I]; t[I]= k;

}

for(I = 10; I & gt=0; I-)

cout & lt& ltt[I];

}

The program I gave can only sort numbers, and the letters should be written separately ... it can't be realized in one program. ...