58,453
社区成员
发帖
与我相关
我的任务
分享
Map map = new HashMap();
map.put(300, 3); //value and key
map.put(100, 1); //value and key
map.put(200, 2); //value and key
System.out.print(map.entrySet());
package S1java.sg.chap8;
import java.util.*;
class A{
public static void main(String[]agrs){
int x = 0;
Scanner input=new Scanner(System.in);
int[]a=new int[8];
int min;
System.out.println("请输入8位顾客的积分:");
for(int i=0;i <8;i++){
a[i]=input.nextInt();
}
min=a[0];
for(int index=1;index <8;index++){
if(a[index] <min){
min=a[index];
x = index;
}
}
System.out.print("本次积分最低的是:"+min+",其位置为:"+x);
}
}
package S1java.sg.chap8;
import java.util.*;
class A{
public static void main(String[]agrs){
Scanner input=new Scanner(System.in);
int[]a=new int[8];
int minIndex;
System.out.println("请输入8位顾客的积分:");
for(int i=0;i <8;i++){
a[i]=input.nextInt();
}
minIndex=0;
for(int index=1;index <8;index++){
if(a[index] <a[minIndex]){
minIndex=index;
}
}
System.out.print("本次积分最低的是:"+a[minIndex]+",其位置是:"+minIndex);
}
}