A C # version of the bubbling ordering method

xiaoxiao2021-03-06  66

Using system;

Namespace consoleApplication2 {///

/// Class1 Summary Description. /// class class1 {/// /// The primary entry point of the application. /// [stathread] static void main (string [] args) {// // Todo: Add code here to start the application // int [] myarray = new int = {10 = new int = , 3, 5, 6, 7, 4, 6, 9}; OutputResult (MyArray); OutputResult (MyArray); MaoPAodesc (MyArray); OutputResult (MyArray);} static void outputResult (int [] MyArray ) {For (int i = 0; i

Static int [] maopaoasc (int [] myarray) {// Take the length of the length of the phrase - bubbling method for (int J = 1; j myarray [i 1], then MyArray [i] up to one IF (MyArray [i]> MyArray [i 1]) {Int Temp = MyArray [i]; myarray [i] = myArray [i 1]; myarray [i 1] = Temp;}}} returray;

} Static int [] maopaodesc (int [] myarray) {// Take the length of the length of the phrase - bubbling method for (int J = 1; j myarray [i 1], then MyArray [i] up to one IF (MyArray [i]

}}}

转载请注明原文地址:https://www.9cbs.com/read-111670.html

New Post(0)