Array operation processing and sequencing of array elements

zhaozj2021-02-16  43

// (1) Find an array element

Static void main (string [] args) {// Todo: Find an array element int [] a = new int [100]; console.writeLine ("Input Number"); string s = console.readline ();

INT x = int32.parse (s); console.writeLine ("/ N input int array element / N");

For (int i = 0; i

Console.writeline ("Search Element / N"); string s3 = console.readline (); int x2 = int32.parse (s3); // cycle portion array for (int i = 0; i

Static void main (string [] args) {// Todo: identify the maximum and smallest elements INT N; FLOAT LARGE, SMALL; int [] a = new int [50]; console.writeline ("Enter int Ar Group Size" ); String s = console.readLine (); n = int32.Parse (s); console.writeLine ("Input array element"); for (int i = 0; i large) Large = a [i]; // Update the large variable ELSE IF (a [i]

-------------------------------------------- // array elements Bubble sort

/ * The first pass increases to the topmost of the array, the second pass, the remaining minimum rises to the second position, no need to compare the top record when scanning the second pass * /

Static void main (string [] args) {int [] a = new int [100]; console.writeline ("Enter the number of elements in the int array"); string s = console.readline (); int x = int32. PARSE (S); Console.Writeline ("Input Element"); for (int J = 0; j

INT LIMIT = X-1; for (int pass = 0; Pass a [j 1]) {INT K = a [j]; // array element exchange A [j] = a [j 1]; // array element exchange A [j 1] = k; // array element exchange}}} }

Console.writeline ("Sorted Elements of An Array Area);

For (int J = 0; j

---------------------------------------

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

New Post(0)