Home > Back-end >  Bubble sort method, all sorts of not to come out, the novice pray that god will guide?
Bubble sort method, all sorts of not to come out, the novice pray that god will guide?

Time:10-19

#include
Void main ()
{
Int a, [10].
Int I, j, t;
for (i=0; i<10; I++)
{
Printf (" a [% d]=", I);
The scanf (" % d ", & amp; A [I]);
}
for (i=0; i<9. I++)
for(j=0; J<9 - I; J++)
{
If (a [j] & gt; A [m + 1])
T=a, [j].
A [j]=a, a + 1 bonus to [j].
A [m + 1]=t;
}
for (i=0; i<10; I++)
Printf (" % d ", a [I]);
}
Procedures should be no problem, but I can't!

CodePudding user response:

 # include & lt; stdio.h> 
Void main ()
{
Int a, [10].
Int I, j, t;
for (i=0; i<10; I++)
{
Printf (" a [% d]=", I);
The scanf (" % d ", & amp; A [I]);
}
for (i=0; i<9. I++)
for(j=0; J<9 - I; J++)
{
If (a [j] & gt; A [m + 1])
{//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +
T=a, [j].
A [j]=a, a + 1 bonus to [j].
A [m + 1]=t;
}//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +
}
for (i=0; i<10; I++)
Printf (" % d ", a [I]);
}

CodePudding user response:

 # include & lt; stdio.h> 
Void main ()
{
Int a, [10].
int i, j, t;
for (i=0; I & lt; 10; I++) {
Printf (" a [% d]=", I);
The scanf (" % d ", & amp; A [I]);
}
for (i=0; I & lt; 9. I++) {
For (j=0; J & lt; 9. J++) {
If (a [j + 1] T=a, [j].
A [j]=a, a + 1 bonus to [j].
A [m + 1]=t;
}
}
}
for (i=0; I & lt; 10; I++) printf (" % d ", a [I]);
}

CodePudding user response:

 # include & lt; stdio.h> 
Void main ()
{
Int a, [10].
int i, j, t;
for (i=0; I & lt; 10; I++) {
Printf (" a [% d]=", I);
The scanf (" % d ", & amp; A [I]);
}
for (i=0; I & lt; 9. I++) {
For (j=0; J & lt; 9. J++) {
If (a [j + 1]
T=a, [j].
A [j]=a, a + 1 bonus to [j].
A [m + 1]=t;
}
}
}
for (i=0; I & lt; 10; I++) printf (" % d ", a [I]);
}

CodePudding user response:

 

34567891011121314151617181920212223 # include & lt; stdio.h> Void main () {int a, [10]. Int I, j, t; for (i=0; i<10; I++) {printf (" a [% d]=", I); The scanf (" % d ", & amp; A [I]); } the for (I=0; i<9. I++) for (j=0; J<9 - I; J++) {if (a [j] & gt; + 1 a [j]) {//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + t=a, [j]. A [j]=a, a + 1 bonus to [j]. A [m + 1]=t; }//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +} for (I=0; i<10; I++) printf (" % d ", a [I]); }

CodePudding user response:

After the if less a pair of {}
  • Related