Dual method demonstration

xiaoxiao2021-03-06  45

/ ************************************************** ************

* This program finds an index of the specified number in the specified sequence

* Adoption

* Order array lookup specified number

* CODER: Nine Day Shenlong

* Lastupdate 11/25/2004

*********************************************************** ************ /

Import java.lang. *;

Class FindIndex {

// *********************************************

// Function Name Index

/ / The main function of this program,

// Use two-point method to find the index of the element in the specified array

// Parameter a, specified array

// NUM to find the number

// Return the value of the specified element to the index value of the specified element

// Nothing to return -1;

// ***************************************

Static int index (int]) {

INT spos = 0;

Int epos = a.length;

WHILE (SPOS)

Num)

EPOS = POS;

Else IF (a [POS]

#Number is the number to find ");

}

Else IF (args.length == 1) {

Int [] a = {3, 5, 9, 23, 54, 67, 89, 231};

INT i = index (a, integer.parseint);

System.out.print (ARGS [0] "subscript");

System.out.println (i);

}

}

}

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

New Post(0)