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. ...
- Previous article:How to judge whether the rib is broken?
- Next article:Which university in Britain studies photography well?
- Related articles
- Why can't the mobile phone shoot the blue sky?
- A good place to write
- What has nikola tesla, a talented scientist, achieved?
- Five templates of fun sports meeting planning book
- On Idiom Translation of "Snow"
- The meaning of the first two games and the meaning of the last two sentences to send Yuan Er to Anxi.
- Film shooting in Shuangyue Bay
- What major is good in a technical school?
- Shenzhen Guanlan Foxconn recruitment address
- A midsummer night's dream of rock.