Void main ()
{
Int a, [10].
Int I, j, min, t;
Printf (" input a array: \ n ");
for(i=0; i<10; I++)
The scanf (" % d ", & amp; A [I]);
for(i=0; i<9. I++)
{
Min=I;
For (j=I; J<10; J++)
//{
If (a/min & gt; A [j])
Min=j;
T=a [I];
A [I]=a/min;
A [min]=t;
//}
}
Printf (" the exchanged array is: \ n ");
for(i=0; i<10; I++)
printf("%d ",a[i]);
}
Question:
Is to make the//the two braces, why can't we have
If have, for example,
Input 32 45 6 November 7, 66, 90, 72 10 178
The result is
6 7 11 32 45, 66, 72, 90 178
CodePudding user response:
Not very understand your problem, or said the topic request, this code to achieve what effect?CodePudding user response:
Selection sortAdd parentheses words
The last two number 10 178
For (j=8; J<10; J++)
{
If (a [8] & gt; A [8])//does not meet the
Min=j;//not perform
Exchange a [8] and a [8] the value of the
After the if (a [8] & gt; A [9])//or does not meet the
Min=j//or does not perform
Or exchange a [8] and a [8] the value of the
So a [8] didn't change
CodePudding user response:
For (j=I; J<10; J++)J=no sense I
Into a j=I + 1
CodePudding user response: